Passed
Branch main (d1c4d1)
by William
12:03
created
src/PubSub/PubSub.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
     ) {
111 111
         if ($sleepSeconds < 1) $sleepSeconds = 1;
112 112
 
113
-        $this->loopConnection(function () use ($sleepSeconds, $queueName) {
113
+        $this->loopConnection(function() use ($sleepSeconds, $queueName) {
114 114
 
115 115
             /** como no pubsub ao perder a conexão, a fila exclusiva é excluida, é necessário configurar
116 116
              * fila e etc novamente
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
                 true,
127 127
                 false,
128 128
                 false,
129
-                function (AMQPMessage $message) {
129
+                function(AMQPMessage $message) {
130 130
                     //se o status for negativo, não executa o consumo
131 131
                     $checkStatusCallback = $this->onCheckStatusCallback;
132 132
                     $statusBoolean = $checkStatusCallback();
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -108,7 +108,9 @@
 block discarded – undo
108 108
         string $queueName,
109 109
         int    $sleepSeconds = 3
110 110
     ) {
111
-        if ($sleepSeconds < 1) $sleepSeconds = 1;
111
+        if ($sleepSeconds < 1) {
112
+            $sleepSeconds = 1;
113
+        }
112 114
 
113 115
         $this->loopConnection(function () use ($sleepSeconds, $queueName) {
114 116
 
Please login to merge, or discard this patch.
src/Queue/Queue.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
             throw new \Exception("Define a onExecuting callback");
120 120
         }
121 121
 
122
-        $this->loopConnection(function () use ($sleepSeconds, $queueName) {
122
+        $this->loopConnection(function() use ($sleepSeconds, $queueName) {
123 123
 
124 124
             $this->createQueue($queueName);
125 125
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
                 false,
133 133
                 false,
134 134
                 false,
135
-                function (AMQPMessage $message) {
135
+                function(AMQPMessage $message) {
136 136
                     //se o status for negativo, não executa o consumo
137 137
                     if (!empty($this->onCheckStatusCallback)) {
138 138
                         $checkStatusCallback = $this->onCheckStatusCallback;
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -113,7 +113,9 @@
 block discarded – undo
113 113
         string $queueName,
114 114
         int    $sleepSeconds = 3
115 115
     ) {
116
-        if ($sleepSeconds < 1) $sleepSeconds = 1;
116
+        if ($sleepSeconds < 1) {
117
+            $sleepSeconds = 1;
118
+        }
117 119
 
118 120
         if (empty($this->onExecutingCallback)) {
119 121
             throw new \Exception("Define a onExecuting callback");
Please login to merge, or discard this patch.
src/Base.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
          * Faz a execucao parar ao enviar um sinal do linux para matar o script
32 32
          */
33 33
         if (php_sapi_name() == "cli") {
34
-            \pcntl_signal(SIGTERM, function ($signal) {
34
+            \pcntl_signal(SIGTERM, function($signal) {
35 35
                 $this->shutdown($signal);
36 36
             }, false);
37
-            \pcntl_signal(SIGINT, function ($signal) {
37
+            \pcntl_signal(SIGINT, function($signal) {
38 38
                 $this->shutdown($signal);
39 39
             }, false);
40 40
         }
@@ -56,10 +56,10 @@  discard block
 block discarded – undo
56 56
                 print "Caught SIGTERM {$data}" . PHP_EOL;
57 57
                 exit;
58 58
             case SIGKILL:
59
-                print "Caught SIGKILL {$data}" . PHP_EOL;;
59
+                print "Caught SIGKILL {$data}" . PHP_EOL; ;
60 60
                 exit;
61 61
             case SIGINT:
62
-                print "Caught SIGINT {$data}" . PHP_EOL;;
62
+                print "Caught SIGINT {$data}" . PHP_EOL; ;
63 63
                 exit;
64 64
         }
65 65
     }
Please login to merge, or discard this patch.
demo/queue_db/PdoDriver.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
         $stmt->execute();
44 44
         $task = $stmt->fetch(\PDO::FETCH_ASSOC);
45 45
 
46
-        if(empty($task)) {
46
+        if (empty($task)) {
47 47
             return false;
48 48
         }
49 49
 
Please login to merge, or discard this patch.
demo/queue_db/consumer.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,12 +23,12 @@  discard block
 block discarded – undo
23 23
 $model = new PdoMonitor("rabbit_monitor", $consumerName, 'servicos');
24 24
 $model->insertConsumerIfNotExists();
25 25
 
26
-$worker->onCheckStatus(function () use ($consumerName) {
26
+$worker->onCheckStatus(function() use ($consumerName) {
27 27
     $model = new PdoMonitor("rabbit_monitor", $consumerName, 'servicos');
28 28
     return $model->workerIsRunning();
29 29
 });
30 30
 
31
-$worker->onReceive(function ($dados) {
31
+$worker->onReceive(function($dados) {
32 32
     $id = $dados['payload']['id'];
33 33
     echo ' [x] [  receive  ] ', $id, "\n";
34 34
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
     return true;
53 53
 });
54
-$worker->onExecuting(function (AMQPMessage $message, $dados) {
54
+$worker->onExecuting(function(AMQPMessage $message, $dados) {
55 55
     $payload = $dados['payload'];
56 56
 
57 57
     echo ' [x] [  executing  ] ', $payload['id'], "\n";
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 
64 64
     echo ' [x] [  success  ] ', $payload['id'], "\n";
65 65
 });
66
-$worker->onError(function (\Exception $e, $dados) {
66
+$worker->onError(function(\Exception $e, $dados) {
67 67
     $payload = $dados['payload'];
68 68
     $id = $payload['id'];
69 69
 
Please login to merge, or discard this patch.
demo/pubsub/consumer.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  * Utilidade: Dizer se o worker está ativo, com base em algum registro de banco de dados, monitor de serviços
24 24
  * e etc
25 25
  */
26
-$worker->onCheckStatus(function () {
26
+$worker->onCheckStatus(function() {
27 27
 
28 28
 });
29 29
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
  *
34 34
  * Se não retornar nada ou verdadeiro, o item é processado no método onExecuting
35 35
  */
36
-$worker->onReceive(function ($dados) {
36
+$worker->onReceive(function($dados) {
37 37
     echo ' [x] [  receive  ] ', json_encode($dados), "\n";
38 38
 });
39 39
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
  * Se alguma exception não for tratada, o item será recolocado
49 49
  * na fila
50 50
  */
51
-$worker->onExecuting(function (AMQPMessage $message, $dados) {
51
+$worker->onExecuting(function(AMQPMessage $message, $dados) {
52 52
     echo ' [x] [ executing ] ', json_encode($dados), "\n";
53 53
 });
54 54
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
  * Método que executa automaticamente caso aconteça uma exception não tratada
57 57
  * durante o processamento
58 58
  */
59
-$worker->onError(function (\Exception $e, $dados) {
59
+$worker->onError(function(\Exception $e, $dados) {
60 60
     echo ' [x] [   error   ] ', json_encode($dados), "\n";
61 61
 });
62 62
 
Please login to merge, or discard this patch.
demo/pubsub/Process.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
         // $fakeException = rand() % 2 === 0;
18 18
         // if ($fakeException) throw new \Exception("=== Erro ===");
19 19
 
20
-        echo "Processado".PHP_EOL;
20
+        echo "Processado" . PHP_EOL;
21 21
 
22 22
 
23 23
         /** Marca o item como erro */
Please login to merge, or discard this patch.
demo/queue/consumer.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  * Utilidade: Dizer se o worker está ativo, com base em algum registro de banco de dados, monitor de serviços
24 24
  * e etc
25 25
  */
26
-$worker->onCheckStatus(function () {
26
+$worker->onCheckStatus(function() {
27 27
 
28 28
 });
29 29
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
  *
34 34
  * Se não retornar nada ou verdadeiro, o item é processado no método onExecuting
35 35
  */
36
-$worker->onReceive(function ($dados) {
36
+$worker->onReceive(function($dados) {
37 37
     echo ' [x] [  receive  ] ', json_encode($dados), "\n";
38 38
 });
39 39
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
  * Se alguma exception não for tratada, o item será recolocado
49 49
  * na fila
50 50
  */
51
-$worker->onExecuting(function (AMQPMessage $message, $dados) {
51
+$worker->onExecuting(function(AMQPMessage $message, $dados) {
52 52
 
53 53
     echo ' [x] [ executing ] ', json_encode($dados), "\n";
54 54
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
  * Método que executa automaticamente caso aconteça uma exception não tratada
63 63
  * durante o processamento
64 64
  */
65
-$worker->onError(function (\Exception $e, $dados) {
65
+$worker->onError(function(\Exception $e, $dados) {
66 66
     echo ' [x] [   error   ] ', json_encode($dados), "\n";
67 67
 });
68 68
 
Please login to merge, or discard this patch.