Completed
Push — master ( a12146...64a44a )
by Joao
02:25
created
src/Handler/PThreadHandler.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
             return $this->loader;
40 40
         }
41 41
 
42
-        $path = __DIR__ . '/../../vendor/autoload.php';
42
+        $path = __DIR__.'/../../vendor/autoload.php';
43 43
         if (!file_exists($path)) {
44
-            $path = __DIR__ . '/../../../../autoload.php';
44
+            $path = __DIR__.'/../../../../autoload.php';
45 45
             if (!file_exists($path)) {
46 46
                 throw new \RuntimeException("Autoload path '$path' not found");
47 47
             }
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
      */
88 88
     public function getResult()
89 89
     {
90
-        if ($this->hasError && ( $this->hasError['type'] == E_ERROR || $this->hasError['type'] == E_USER_ERROR )) {
90
+        if ($this->hasError && ($this->hasError['type'] == E_ERROR || $this->hasError['type'] == E_USER_ERROR)) {
91 91
             throw new \RuntimeException(
92 92
                 sprintf(
93 93
                     'Thread error: "%s", in "%s" at line %d. <<--- ',
Please login to merge, or discard this patch.
example_pool.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -5,13 +5,13 @@  discard block
 block discarded – undo
5 5
 // Method to be executed in a thread
6 6
 function Foo($t)
7 7
 {
8
-    echo "Starting thread #$t" . PHP_EOL;;
8
+    echo "Starting thread #$t".PHP_EOL; ;
9 9
     sleep(1 * rand(1, 5));
10 10
     for ($i = 0; $i < 10; $i++) {
11
-        echo "Hello from thread #$t, i=$i" . PHP_EOL;
11
+        echo "Hello from thread #$t, i=$i".PHP_EOL;
12 12
         sleep(1);
13 13
     }
14
-    echo "Ending thread #$t" . PHP_EOL;
14
+    echo "Ending thread #$t".PHP_EOL;
15 15
 
16 16
     return uniqid("Thread_{$t}_");
17 17
 }
@@ -33,18 +33,18 @@  discard block
 block discarded – undo
33 33
     // Wait until there is no more active workers
34 34
     // You can use $threadPool->waitWorkers() instead the loop below
35 35
     while ($threadPool->activeWorkers() > 0) {
36
-        echo "Active Workers : " . $threadPool->activeWorkers() . "\n";
36
+        echo "Active Workers : ".$threadPool->activeWorkers()."\n";
37 37
         sleep(1);
38 38
     }
39 39
 
40 40
     // Get the return value from the thread.
41 41
     foreach ($threadPool->getThreads() as $thid) {
42
-        echo 'Result: ' . $threadPool->getThreadResult($thid) . "\n";
42
+        echo 'Result: '.$threadPool->getThreadResult($thid)."\n";
43 43
     }
44 44
 
45 45
     echo "\n\nEnded!\n";
46 46
 
47 47
 } catch (Exception $e) {
48
-    echo 'Exception: ' . $e . PHP_EOL;
48
+    echo 'Exception: '.$e.PHP_EOL;
49 49
 }
50 50
 
Please login to merge, or discard this patch.