Total Complexity | 4 |
Total Lines | 52 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
7 | class TestThread extends AbstractThread { |
||
8 | |||
9 | /** |
||
10 | * @var array |
||
11 | */ |
||
12 | private $dependencies; |
||
13 | |||
14 | /** |
||
15 | * TestThread constructor. |
||
16 | * |
||
17 | * @param string $processName |
||
18 | * @param $dependencies |
||
19 | */ |
||
20 | public function __construct(string $processName, $dependencies) |
||
21 | { |
||
22 | parent::__construct($processName); |
||
23 | $this->dependencies = $dependencies; |
||
24 | } |
||
25 | |||
26 | /** |
||
27 | * @param $processName |
||
28 | * @param $date |
||
29 | * @return int |
||
30 | */ |
||
31 | protected function process($processName, $date) |
||
32 | { |
||
33 | echo $processName . " " . $date . PHP_EOL; |
||
34 | sleep(1); |
||
35 | |||
36 | $this->notify(new TestEvent('toto')); |
||
37 | |||
38 | return self::EXIT_STATUS_SUCCESS; |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * Return the name of the method to process during the thread |
||
43 | * |
||
44 | * @return string |
||
45 | */ |
||
46 | protected function getMethodName(): string |
||
47 | { |
||
48 | return 'process'; |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * Return the list of dependencies that will be passed as parameters of the method referenced by getMethodName |
||
53 | * |
||
54 | * @return array |
||
55 | */ |
||
56 | protected function getDependencies(): array |
||
59 | } |
||
60 | } |