1 | <?php |
||
7 | class PThreadHandler extends \Thread implements ThreadInterface |
||
8 | { |
||
9 | /** |
||
10 | * @var ClassLoader |
||
11 | */ |
||
12 | private $loader; |
||
13 | |||
14 | /** |
||
15 | * @var callable |
||
16 | */ |
||
17 | private $callable; |
||
18 | |||
19 | private $args; |
||
20 | |||
21 | private $result; |
||
22 | |||
23 | private $hasError; |
||
24 | |||
25 | /** |
||
26 | * Thread constructor. |
||
27 | */ |
||
28 | public function __construct() |
||
32 | |||
33 | /** |
||
34 | * @return ClassLoader |
||
35 | */ |
||
36 | public function getLoader() |
||
53 | |||
54 | protected function threadError() |
||
58 | |||
59 | /** |
||
60 | * Here you are in a threaded environment |
||
61 | */ |
||
62 | public function run() |
||
70 | |||
71 | /** |
||
72 | * Start the thread |
||
73 | * |
||
74 | * @throws \RuntimeException |
||
75 | */ |
||
76 | public function execute() |
||
81 | |||
82 | /** |
||
83 | * Get the thread result |
||
84 | * |
||
85 | * @return mixed |
||
86 | * @throws \RuntimeException |
||
87 | */ |
||
88 | public function getResult() |
||
102 | |||
103 | /** |
||
104 | * Kill a thread |
||
105 | * |
||
106 | * @param int $signal |
||
107 | * @param bool $wait |
||
108 | */ |
||
109 | public function stop($signal = SIGKILL, $wait = false) |
||
113 | |||
114 | /** |
||
115 | * Checkif the thread is not Terminated |
||
116 | * |
||
117 | * @return bool |
||
118 | */ |
||
119 | public function isAlive() |
||
131 | |||
132 | /** |
||
133 | * Set the thread callable method |
||
134 | * @param callable $callable |
||
135 | * @return mixed |
||
136 | */ |
||
137 | public function setCallable(callable $callable) |
||
141 | |||
142 | public function waitFinish() |
||
146 | } |
||
147 |
This check looks for a call to a parent method whose name is different than the method from which it is called.
Consider the following code:
The
getFirstName()
method in theSon
calls the wrong method in the parent class.