/** * {@inheritdoc} * * @param \stdClass $response Fatmouse response part. * * @return void */ protected function initFromResponse(\stdClass $response) { parent::initFromResponse($response); if (!$this->isFailed() && $response->result !== null) { $clsName = WorkflowName::resultClassForName($this->name); if ($clsName) { $this->result = (new \ReflectionClass($clsName))->newInstance(); $this->result->initFromResponse($response->result); } } $this->completedTasks = array_map([Task::class, 'newFromResponse'], $response->completed_tasks); $this->failedTasks = array_map([Task::class, 'newFromResponse'], $response->failed_tasks); }