@@ -126,7 +126,6 @@ |
||
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 | } |
@@ -121,7 +121,7 @@ |
||
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 | { |
@@ -143,8 +143,7 @@ |
||
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 |
@@ -104,7 +104,7 @@ |
||
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 | } |
@@ -127,8 +127,7 @@ discard block |
||
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 |
||
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 | } |
@@ -179,7 +179,7 @@ |
||
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 | { |
@@ -115,7 +115,7 @@ discard block |
||
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 |
||
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 | ); |
@@ -123,9 +123,9 @@ |
||
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 | /** |
@@ -46,7 +46,7 @@ |
||
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 |
@@ -86,7 +86,7 @@ discard block |
||
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 |
||
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); |
@@ -114,10 +114,10 @@ |
||
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 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | public function processStage(array $requestDescriptors) |
24 | 24 | { |
25 | 25 | /** @var RequestDescriptor[] $requestDescriptors */ |
26 | - $result = [ ]; |
|
26 | + $result = []; |
|
27 | 27 | $microTime = microtime(true); |
28 | 28 | foreach ($requestDescriptors as $key => $descriptor) { |
29 | 29 | $isTimeout = $this->isSingleSocketTimeout($descriptor, $microTime) && |
@@ -52,8 +52,7 @@ discard block |
||
52 | 52 | $meta[RequestExecutorInterface::META_USER_CONTEXT], |
53 | 53 | $meta[RequestExecutorInterface::META_CONNECTION_FINISH_TIME] !== null && |
54 | 54 | !$descriptor->getSocket()->isServer() ? |
55 | - TimeoutEvent::DURING_IO : |
|
56 | - TimeoutEvent::DURING_CONNECTION |
|
55 | + TimeoutEvent::DURING_IO : TimeoutEvent::DURING_CONNECTION |
|
57 | 56 | ); |
58 | 57 | try { |
59 | 58 | $this->callSocketSubscribers($descriptor, $event); |
@@ -30,7 +30,7 @@ |
||
30 | 30 | $socket, |
31 | 31 | sprintf( |
32 | 32 | 'System has detected a zombie connection %s and closed it. '. |
33 | - 'If you see this message it means that application ' . |
|
33 | + 'If you see this message it means that application '. |
|
34 | 34 | 'has lost control on one of its sockets.', |
35 | 35 | (string) $socket |
36 | 36 | ) |