/** * {@inheritdoc} */ protected function doWrite($message, $newline) { if ($newline) { $message .= "\n"; } $this->task->addOutput($message); }
/** * Called upon PHP shutdown. * * @return void */ public function handleError() { if (!$this->shutdownHandlerActive) { return; } $error = error_get_last(); if ($error['type'] === E_ERROR) { $message = sprintf('Error: "%s" in %s on %s', $error['message'], $error['file'], $error['line']); $this->task->markError(); $this->task->addOutput($message); $this->logger->error($message); } // Ensure to release the lock. $this->releaseLock(); }
/** * Test that all known task types are not supported. * * @param Task $task The task to test. * * @return void * * @dataProvider supportedTaskTypesProvider */ public function testDoesSupportKnown(Task $task) { $factory = new ComposerTaskFactory(new HomePathDeterminator($this->getTempDir())); $this->assertTrue($factory->isTypeSupported($task->getType()), 'Task unsupported in factory: ' . $task->getType()); }
/** * Convert a task to an array. * * @param Task $task The task to convert. * * @param bool $addOutput Flag determining if the output shall get added or not. * * @param null $outputOffset The output offset to use. * * @return array */ private function convertTaskToArray(Task $task, $addOutput = false, $outputOffset = null) { $data = ['id' => $task->getId(), 'status' => $task->getStatus(), 'type' => $task->getType(), 'created_at' => $task->getCreatedAt()->format(\DateTime::ISO8601), 'user_data' => $task->getUserData()]; if (true === $addOutput) { $data['output'] = $task->getOutput($outputOffset); } return $data; }