bfe257bd21c7984b0ba66425042c7e84eeb78282
[yaffs-website] / vendor / consolidation / annotated-command / src / CommandError.php
1 <?php
2 namespace Consolidation\AnnotatedCommand;
3
4 /**
5  * Return a CommandError as the result of a command to pass a status
6  * code and error message to be displayed.
7  *
8  * @package Consolidation\AnnotatedCommand
9  */
10 class CommandError implements ExitCodeInterface, OutputDataInterface
11 {
12     protected $message;
13     protected $exitCode;
14
15     public function __construct($message = null, $exitCode = 1)
16     {
17         $this->message = $message;
18         // Ensure the exit code is non-zero. The exit code may have
19         // come from an exception, and those often default to zero if
20         // a specific value is not provided.
21         $this->exitCode = $exitCode == 0 ? 1 : $exitCode;
22     }
23     public function getExitCode()
24     {
25         return $this->exitCode;
26     }
27
28     public function getOutputData()
29     {
30         return $this->message;
31     }
32 }