Completed
Pull Request — master (#10)
by Alice
03:35
created

TestThread::getDependencies()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Wonderland\Thread\Example\Simple;
4
5
use Wonderland\Thread\AbstractThread;
6
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
35
        $this->notify(new TestEvent('toto'));
36
        sleep(1);
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
57
    {
58
        return $this->dependencies;
59
    }
60
}