Total Complexity | 7 |
Total Lines | 51 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
12 | abstract class RabbitReceiver extends Rabbit // implements Interface |
||
13 | { |
||
14 | /** |
||
15 | * The handler of the messages received from queue |
||
16 | * @var mixed $message Received from rabbitmq queue |
||
17 | */ |
||
18 | protected function handler($message) |
||
22 | } |
||
23 | |||
24 | /** |
||
25 | * Infinite loop for listen the queue messages |
||
26 | */ |
||
27 | protected function consume() |
||
28 | { |
||
29 | $callback = function ($message) { |
||
30 | $this->handler($message); |
||
31 | }; |
||
32 | $this->channel->basic_consume($this->getQueue(), 'consumer', false, $this->getReply(), false, false, $callback); |
||
33 | |||
34 | $pid = pcntl_fork(); |
||
35 | |||
36 | if ($pid == -1) { |
||
37 | echo "can i help u ?"; |
||
38 | } else if ($pid) { |
||
39 | while (true) { |
||
40 | $this->sendHeartbeat(); |
||
41 | sleep(10); |
||
42 | } |
||
43 | } else { |
||
44 | while (count($this->channel->callbacks)) { |
||
45 | $this->channel->wait(); |
||
46 | } |
||
47 | } |
||
48 | |||
49 | $this->closeConnection(); |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * work on PhpAmqpLib 2.9.2 |
||
54 | */ |
||
55 | private function sendHeartbeat() |
||
63 | } |
||
64 | } |
||
65 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths