Completed
Branch 0.4-dev (d27253)
by Evgenij
03:26
created
src/Frame/MarkerFramePicker.php 2 patches
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -126,7 +126,6 @@
 block discarded – undo
126 126
     protected function findMarker($haystack, $needle, $offset = 0)
127 127
     {
128 128
         return $this->isCaseSensitive ?
129
-            strpos($haystack, $needle, $offset) :
130
-            stripos($haystack, $needle, $offset);
129
+            strpos($haystack, $needle, $offset) : stripos($haystack, $needle, $offset);
131 130
     }
132 131
 }
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@
 block discarded – undo
121 121
      * @param string $needle What to find
122 122
      * @param int    $offset Start offset in $haystack
123 123
      *
124
-     * @return bool|int
124
+     * @return string
125 125
      */
126 126
     protected function findMarker($haystack, $needle, $offset = 0)
127 127
     {
Please login to merge, or discard this patch.
src/Socket/Io/AbstractClientIo.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -143,8 +143,7 @@
 block discarded – undo
143 143
         $resource = $this->socket->getStreamResource();
144 144
         if (!is_resource($resource)) {
145 145
             $message = $this->state === self::STATE_CONNECTED ?
146
-                'Connection was unexpectedly closed.' :
147
-                'Can not start io operation on uninitialized socket.';
146
+                'Connection was unexpectedly closed.' : 'Can not start io operation on uninitialized socket.';
148 147
             throw new ConnectionException($this->socket, $message);
149 148
         }
150 149
 
Please login to merge, or discard this patch.
src/RequestExecutor/Pipeline/AbstractStage.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@
 block discarded – undo
104 104
         return new Event(
105 105
             $this->executor,
106 106
             $operation->getSocket(),
107
-            $meta[ RequestExecutorInterface::META_USER_CONTEXT ],
107
+            $meta[RequestExecutorInterface::META_USER_CONTEXT],
108 108
             $eventName
109 109
         );
110 110
     }
Please login to merge, or discard this patch.
src/RequestExecutor/Pipeline/SelectStage.php 2 patches
Spacing   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -127,8 +127,7 @@  discard block
 block discarded – undo
127 127
     private function getMinTimeout($newValue, $oldValue)
128 128
     {
129 129
         return (($newValue > 0 && $newValue < $oldValue) || $oldValue === null) ?
130
-            $newValue :
131
-            $oldValue;
130
+            $newValue : $oldValue;
132 131
     }
133 132
 
134 133
     /**
@@ -149,8 +148,7 @@  discard block
 block discarded – undo
149 148
         }
150 149
 
151 150
         $result = $lastOperationTime === null ?
152
-            $desiredTimeout :
153
-            $desiredTimeout - ($microTime - $lastOperationTime);
151
+            $desiredTimeout : $desiredTimeout - ($microTime - $lastOperationTime);
154 152
 
155 153
         return $result >= 0 ? $result : 0;
156 154
     }
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -179,7 +179,7 @@
 block discarded – undo
179 179
      * @param RequestDescriptor $operation Operation object
180 180
      * @param double            $microTime Current time with microseconds
181 181
      *
182
-     * @return double|null
182
+     * @return double
183 183
      */
184 184
     private function getSingleSocketTimeout(RequestDescriptor $operation, $microTime)
185 185
     {
Please login to merge, or discard this patch.
src/RequestExecutor/Pipeline/GuardianStage.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
      */
116 116
     private function isZombieCandidate(RequestDescriptor $descriptor)
117 117
     {
118
-        $metadata  = $descriptor->getMetadata();
118
+        $metadata = $descriptor->getMetadata();
119 119
         if ($metadata[RequestExecutorInterface::META_REQUEST_COMPLETE]) {
120 120
             return false;
121 121
         }
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
         $event  = new DataAlertEvent(
165 165
             $this->executor,
166 166
             $socket,
167
-            $meta[ RequestExecutorInterface::META_USER_CONTEXT ],
167
+            $meta[RequestExecutorInterface::META_USER_CONTEXT],
168 168
             $attempt,
169 169
             $totalAttempts
170 170
         );
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -123,9 +123,9 @@
 block discarded – undo
123 123
         $operation = $descriptor->getOperation();
124 124
         return ($operation instanceof NullOperation) ||
125 125
                (
126
-                   $operation instanceof ReadOperation &&
126
+                    $operation instanceof ReadOperation &&
127 127
                    $operation->getFramePicker() instanceof EmptyFramePicker
128
-               );
128
+                );
129 129
     }
130 130
 
131 131
     /**
Please login to merge, or discard this patch.
src/RequestExecutor/Pipeline/ExcludedOperationsStage.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
         foreach ($requestDescriptors as $key => $descriptor) {
48 48
             if (in_array($descriptor, $currentOperations, true)) {
49
-                unset($requestDescriptors[ $key]);
49
+                unset($requestDescriptors[$key]);
50 50
             }
51 51
         }
52 52
 
Please login to merge, or discard this patch.
src/RequestExecutor/Pipeline/IoStage.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
             }
87 87
         }
88 88
 
89
-        throw new \LogicException('There is no handler able to process ' . get_class($operation) . ' operation.');
89
+        throw new \LogicException('There is no handler able to process '.get_class($operation).' operation.');
90 90
     }
91 91
 
92 92
     /**
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
     private function setConnectionFinishTime(RequestDescriptor $requestDescriptor)
158 158
     {
159 159
         $meta         = $requestDescriptor->getMetadata();
160
-        $wasConnected = $meta[ RequestExecutorInterface::META_CONNECTION_FINISH_TIME ] !== null;
160
+        $wasConnected = $meta[RequestExecutorInterface::META_CONNECTION_FINISH_TIME] !== null;
161 161
         $this->setSocketOperationTime($requestDescriptor, RequestExecutorInterface::META_CONNECTION_FINISH_TIME);
162 162
         if (!$wasConnected) {
163 163
             $event = $this->createEvent($requestDescriptor, EventType::CONNECTED);
Please login to merge, or discard this patch.
src/RequestExecutor/Pipeline/TimeoutStage.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -114,10 +114,10 @@
 block discarded – undo
114 114
 
115 115
         return ($desiredTimeout !== RequestExecutorInterface::WAIT_FOREVER) &&
116 116
                (
117
-                   ($hasConnected && $lastOperationTime !== null) ||
117
+                    ($hasConnected && $lastOperationTime !== null) ||
118 118
                    !$hasConnected
119
-               ) &&
119
+                ) &&
120 120
                ($microTime - $lastOperationTime >= $desiredTimeout)
121
-               ;
121
+                ;
122 122
     }
123 123
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     public function processStage(array $requestDescriptors)
25 25
     {
26 26
         /** @var RequestDescriptor[] $requestDescriptors */
27
-        $result    = [ ];
27
+        $result    = [];
28 28
         $microTime = microtime(true);
29 29
         foreach ($requestDescriptors as $key => $descriptor) {
30 30
             $isTimeout = $this->isSingleSocketTimeout($descriptor, $microTime) &&
@@ -53,8 +53,7 @@  discard block
 block discarded – undo
53 53
             $meta[RequestExecutorInterface::META_USER_CONTEXT],
54 54
             $meta[RequestExecutorInterface::META_CONNECTION_FINISH_TIME] !== null &&
55 55
             !($descriptor->getSocket() instanceof ServerSocket) ?
56
-                TimeoutEvent::DURING_IO :
57
-                TimeoutEvent::DURING_CONNECTION
56
+                TimeoutEvent::DURING_IO : TimeoutEvent::DURING_CONNECTION
58 57
         );
59 58
         try {
60 59
             $this->callSocketSubscribers($descriptor, $event);
Please login to merge, or discard this patch.
src/RequestExecutor/Pipeline/DisconnectStage.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -136,13 +136,13 @@
 block discarded – undo
136 136
     private function isDisconnectRequired(SocketInterface $socket)
137 137
     {
138 138
         return (
139
-                   ($socket instanceof PersistentClientSocket) &&
139
+                    ($socket instanceof PersistentClientSocket) &&
140 140
                    (
141
-                       feof($socket->getStreamResource()) !== false ||
141
+                        feof($socket->getStreamResource()) !== false ||
142 142
                        !stream_socket_get_name($socket->getStreamResource(), true)
143
-                   )
144
-               ) || (
145
-                   !($socket instanceof PersistentClientSocket)
146
-               );
143
+                    )
144
+                ) || (
145
+                    !($socket instanceof PersistentClientSocket)
146
+                );
147 147
     }
148 148
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@
 block discarded – undo
97 97
         $descriptor->setMetadata(RequestExecutorInterface::META_REQUEST_COMPLETE, true);
98 98
         try {
99 99
             $socket->close();
100
-            if ($meta[ RequestExecutorInterface::META_CONNECTION_FINISH_TIME ] !== null) {
100
+            if ($meta[RequestExecutorInterface::META_CONNECTION_FINISH_TIME] !== null) {
101 101
                 $this->callSocketSubscribers(
102 102
                     $descriptor,
103 103
                     $this->createEvent($descriptor, EventType::DISCONNECTED)
Please login to merge, or discard this patch.