1 | <?php |
||
31 | final class Manager implements OutputableInterface |
||
32 | { |
||
33 | /** |
||
34 | * @string |
||
35 | */ |
||
36 | const VERSION = '0.1.3'; |
||
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() |
||
142 | |||
143 | /** |
||
144 | * Set the instance of OutputInterface |
||
145 | * |
||
146 | * @param OutputInterface $output |
||
147 | * @return mixed |
||
148 | */ |
||
149 | public function setOutput(OutputInterface $output) |
||
153 | |||
154 | /** |
||
155 | * Returns an instance of OutputInterface |
||
156 | * |
||
157 | * @return OutputInterface |
||
158 | */ |
||
159 | public function getOutput() |
||
167 | } |
||
168 |