Passed
Push — master ( 5e8674...3117ac )
by Marco
02:18
created
src/Comodojo/Daemon/Worker/AbstractWorker.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
 
33 33
     private $id;
34 34
 
35
-    public function __construct($name=null) {
35
+    public function __construct($name = null) {
36 36
 
37 37
         $this->id = uniqid();
38 38
 
Please login to merge, or discard this patch.
src/Comodojo/Daemon/Worker/Loop.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
         $this->events = $worker->getInstance()->getEvents();
51 51
 
52
-        $this->looptime = DataFilter::filterInteger($worker->getLooptime(), $min=1, $max=PHP_INT_MAX, $default=1);
52
+        $this->looptime = DataFilter::filterInteger($worker->getLooptime(), $min = 1, $max = PHP_INT_MAX, $default = 1);
53 53
 
54 54
         $this->events->subscribe('daemon.worker.stop', '\Comodojo\Daemon\Listeners\StopWorker');
55 55
         $this->events->subscribe('daemon.worker.pause', '\Comodojo\Daemon\Listeners\PauseWorker');
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 
74 74
         // start looping
75 75
         $this->setStatus(self::LOOPING);
76
-        while ($this->active) {
76
+        while ( $this->active ) {
77 77
 
78 78
             if ( $this->paused ) {
79 79
                 $this->setStatus(self::PAUSED);
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 
86 86
             $start = microtime(true);
87 87
 
88
-            $this->events->emit( new WorkerEvent('loopstart', $this, $this->worker) );
88
+            $this->events->emit(new WorkerEvent('loopstart', $this, $this->worker));
89 89
 
90 90
             $this->worker->getInstance()->loop();
91 91
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 
94 94
             $elapsed = (microtime(true) - $start);
95 95
 
96
-            $this->events->emit( new WorkerEvent('loopstop', $this, $this->worker) );
96
+            $this->events->emit(new WorkerEvent('loopstop', $this, $this->worker));
97 97
 
98 98
             $lefttime = $this->looptime - $elapsed;
99 99
 
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
         $signal = $this->worker->getOutputChannel()->read();
140 140
 
141 141
         if ( !empty($signal) ) {
142
-            $this->events->emit( new WorkerEvent($signal, $this, $this->worker) );
142
+            $this->events->emit(new WorkerEvent($signal, $this, $this->worker));
143 143
             $this->worker->getOutputChannel()->delete();
144 144
         }
145 145
 
Please login to merge, or discard this patch.
src/Comodojo/Daemon/Worker/SharedMemory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
 
47 47
     public function delete() {
48 48
 
49
-        return shmop_write($this->key, str_pad('',128), 0);
49
+        return shmop_write($this->key, str_pad('', 128), 0);
50 50
 
51 51
     }
52 52
 
Please login to merge, or discard this patch.
src/Comodojo/Daemon/Listeners/WorkerWatchdog.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
         $workers = $daemon->getWorkers();
29 29
         $logger = $daemon->getLogger();
30 30
 
31
-        foreach ($workers as $name => $worker) {
31
+        foreach ( $workers as $name => $worker ) {
32 32
 
33
-            if ($workers->running($worker->getPid())) {
33
+            if ( $workers->running($worker->getPid()) ) {
34 34
 
35 35
                 $logger->debug("Worker $name seems to be running");
36 36
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 
39 39
                 $logger->warning("Worker $name has exited");
40 40
 
41
-                if ($worker->getForever()) {
41
+                if ( $worker->getForever() ) {
42 42
                     $logger->warning("Attempting to restart $name");
43 43
                     $workers->start($name, true);
44 44
                 } else {
Please login to merge, or discard this patch.
src/Comodojo/Daemon/Daemon.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
      * @property LoggerInterface $logger
68 68
      * @property int $pid
69 69
      */
70
-    public function __construct($properties = [], LoggerInterface $logger = null, EventsManager $events = null){
70
+    public function __construct($properties = [], LoggerInterface $logger = null, EventsManager $events = null) {
71 71
 
72 72
         if ( !Checks::multithread() ) {
73 73
             throw new Exception("Missing pcntl fork");
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         $this->console = new CLImate();
99 99
         $this->console->description($properties->description);
100 100
         $args = new $properties->arguments;
101
-        $this->console->arguments->add( $args::create()->export() );
101
+        $this->console->arguments->add($args::create()->export());
102 102
 
103 103
     }
104 104
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 
185 185
         $this->setup();
186 186
 
187
-        foreach ($this->workers as $name => $worker) {
187
+        foreach ( $this->workers as $name => $worker ) {
188 188
 
189 189
             $this->workers->start($name);
190 190
 
@@ -303,9 +303,9 @@  discard block
 block discarded – undo
303 303
 
304 304
     private function detach() {
305 305
 
306
-        if (is_resource(STDOUT)) fclose(STDOUT);
307
-        if (is_resource(STDERR)) fclose(STDERR);
308
-        if (is_resource(STDIN)) fclose(STDIN);
306
+        if ( is_resource(STDOUT) ) fclose(STDOUT);
307
+        if ( is_resource(STDERR) ) fclose(STDERR);
308
+        if ( is_resource(STDIN) ) fclose(STDIN);
309 309
 
310 310
         // become a session leader
311 311
         $sid = posix_setsid();
Please login to merge, or discard this patch.
src/Comodojo/Daemon/Process.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
      * @param LoggerInterface $logger;
45 45
      * @param EventsManager $events;
46 46
      */
47
-    public function __construct($niceness = null, LoggerInterface $logger = null, EventsManager $events = null){
47
+    public function __construct($niceness = null, LoggerInterface $logger = null, EventsManager $events = null) {
48 48
 
49 49
         if ( !Checks::cli() ) {
50 50
             throw new RuntimeException("Process can run only in cli SAPI");
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
 
87 87
             $this->logger->debug("Received $signame ($signal) signal, firing associated event(s)");
88 88
 
89
-            $this->events->emit( new PosixEvent($signal, $this) );
90
-            $this->events->emit( new PosixEvent($signame, $this) );
89
+            $this->events->emit(new PosixEvent($signal, $this));
90
+            $this->events->emit(new PosixEvent($signame, $this));
91 91
 
92 92
         }
93 93
 
Please login to merge, or discard this patch.
src/Comodojo/Daemon/Socket/SocketTransport.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
         LoggerInterface $logger,
20 20
         $data,
21 21
         $content_type,
22
-        $encrypt=false
22
+        $encrypt = false
23 23
     ) {
24 24
 
25 25
         try {
@@ -187,12 +187,12 @@  discard block
 block discarded – undo
187 187
 
188 188
         $datagram = '';
189 189
 
190
-        while (true) {
190
+        while ( true ) {
191 191
             $recv = @socket_read($this->socket, $this->read_buffer, PHP_NORMAL_READ);
192 192
             if ( $recv === false ) break;
193 193
             if ( $recv === 0 ) return null;
194 194
             $datagram .= $recv;
195
-            if(strstr($recv, PHP_EOL)) break;
195
+            if ( strstr($recv, PHP_EOL) ) break;
196 196
         }
197 197
 
198 198
         return trim($datagram);
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 
208 208
             $this->aes->setKey($key);
209 209
 
210
-            $return = 'comodojo_encrypted_request-'.base64_encode( $this->aes->encrypt($data) );
210
+            $return = 'comodojo_encrypted_request-'.base64_encode($this->aes->encrypt($data));
211 211
 
212 212
         } else {
213 213
 
Please login to merge, or discard this patch.
src/Comodojo/Daemon/Socket/MethodsInjector.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
             RpcMethod::create("worker.list", function($params, $daemon) {
24 24
                 $workers = $daemon->getWorkers()->get();
25 25
                 $wlist = [];
26
-                foreach ($workers as $worker => $opts) {
26
+                foreach ( $workers as $worker => $opts ) {
27 27
                     $wlist[] = [
28 28
                         'name' => $worker,
29 29
                         'looptime' => $opts->getLoopTime(),
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
             ->setDescription("Get info about installed worker(s)")
45 45
             ->setReturnType('array')
46 46
             ->addSignature()
47
-            ->addParameter('string','name')
47
+            ->addParameter('string', 'name')
48 48
             ->setReturnType('int')
49 49
         );
50 50
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
             ->setDescription("Pause installed worker(s)")
57 57
             ->setReturnType('array')
58 58
             ->addSignature()
59
-            ->addParameter('string','name')
59
+            ->addParameter('string', 'name')
60 60
             ->setReturnType('boolean')
61 61
         );
62 62
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
             ->setDescription("Resume installed worker(s)")
69 69
             ->setReturnType('array')
70 70
             ->addSignature()
71
-            ->addParameter('string','name')
71
+            ->addParameter('string', 'name')
72 72
             ->setReturnType('boolean')
73 73
         );
74 74
 
Please login to merge, or discard this patch.
src/Comodojo/Daemon/Socket/Connection.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
         $err_code = socket_last_error($socket);
56 56
         $err_string = socket_strerror($err_code);
57 57
 
58
-        if ( $err_code === 11 || strtolower($err_string) == 'success') return true;
58
+        if ( $err_code === 11 || strtolower($err_string) == 'success' ) return true;
59 59
 
60 60
         return $err_string;
61 61
 
Please login to merge, or discard this patch.