private function process($password) { $processor = new TaskProcessor($password); $result = $processor->process($this->bar); if ($result) { $tasksProcesseds = $processor->getTasksProcessed(); foreach ($tasksProcesseds as $task) { $this->tasksProcesseds[] = [$task->task, Date::conversion($task->date), $task->time, $task->description, $task->status]; } } }
/** * @return bool */ public function handle() { $configurationRepository = new ConfigurationRepository(); $enableQueueProcess = $configurationRepository->getValue('enable_queue_process'); $task = Tasks::findOrNew($this->idTask); if (!$enableQueueProcess || !$task->id || $task->status != Tasks::STATUS_PENDING) { return true; } $processor = new TaskProcessor(); $processor->processOneTask($task); return true; }
public function processAction(Request $request) { $success = false; $message = ''; $code = null; try { $processor = new TaskProcessor($request->get('password', null)); $success = $processor->process(); } catch (\Exception $e) { $message = $e->getMessage(); $code = $e->getCode(); } return JsonResponse::create(['success' => $success, 'message' => $message, 'code' => $code]); }