1 | <?php |
||
31 | final class Manager implements OutputableInterface |
||
32 | { |
||
33 | /** |
||
34 | * @string |
||
35 | */ |
||
36 | const VERSION = '0.1.2'; |
||
37 | |||
38 | /** |
||
39 | * @string |
||
40 | */ |
||
41 | const NAME = 'Nyx - Process Manager'; |
||
42 | |||
43 | /** |
||
44 | * @var |
||
45 | */ |
||
46 | protected $pools; |
||
47 | |||
48 | /** |
||
49 | * @var OutputInterface |
||
50 | */ |
||
51 | protected $output; |
||
52 | |||
53 | /** |
||
54 | * @var Handler |
||
55 | */ |
||
56 | protected $handler; |
||
57 | |||
58 | /** |
||
59 | * Create a Manager instance using config |
||
60 | * |
||
61 | * @param $path |
||
62 | * @return static |
||
63 | * @throws \Exception |
||
64 | */ |
||
65 | public static function factory($path) |
||
90 | |||
91 | /** |
||
92 | * Manager constructor |
||
93 | * |
||
94 | * @param array $pools |
||
95 | */ |
||
96 | public function __construct(array $pools) |
||
102 | |||
103 | /** |
||
104 | * Add a pool to the manager |
||
105 | * |
||
106 | * @param PoolInterface $pool |
||
107 | */ |
||
108 | public function addPool(PoolInterface $pool) |
||
112 | |||
113 | /** |
||
114 | * Run the manager by looping through the pools and starting the workers. |
||
115 | * |
||
116 | * @return void |
||
117 | */ |
||
118 | public function run() |
||
143 | |||
144 | /** |
||
145 | * Set the instance of OutputInterface |
||
146 | * |
||
147 | * @param OutputInterface $output |
||
148 | * @return mixed |
||
149 | */ |
||
150 | public function setOutput(OutputInterface $output) |
||
154 | |||
155 | /** |
||
156 | * Returns an instance of OutputInterface |
||
157 | * |
||
158 | * @return OutputInterface |
||
159 | */ |
||
160 | public function getOutput() |
||
168 | } |
||
169 |
An exit expression should only be used in rare cases. For example, if you write a short command line script.
In most cases however, using an
exit
expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.