@@ -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 | |
@@ -68,9 +68,8 @@ |
||
| 68 | 68 | 'udg' => 1, |
| 69 | 69 | ]; |
| 70 | 70 | |
| 71 | - return isset($connectionLessMap[ $scheme ]) ? |
|
| 72 | - STREAM_SERVER_BIND : |
|
| 73 | - STREAM_SERVER_BIND | STREAM_SERVER_LISTEN; |
|
| 71 | + return isset($connectionLessMap[$scheme]) ? |
|
| 72 | + STREAM_SERVER_BIND : STREAM_SERVER_BIND | STREAM_SERVER_LISTEN; |
|
| 74 | 73 | } |
| 75 | 74 | |
| 76 | 75 | /** {@inheritdoc} */ |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | $operation, |
| 51 | 51 | $executor, |
| 52 | 52 | $socket, |
| 53 | - $meta[ RequestExecutorInterface::META_USER_CONTEXT ] |
|
| 53 | + $meta[RequestExecutorInterface::META_USER_CONTEXT] |
|
| 54 | 54 | ); |
| 55 | 55 | $eventHandler->invokeEvent($event); |
| 56 | 56 | $nextOperation = $event->getNextOperation(); |
@@ -75,7 +75,7 @@ |
||
| 75 | 75 | |
| 76 | 76 | try { |
| 77 | 77 | $socket->close(); |
| 78 | - if ($meta[ RequestExecutorInterface::META_CONNECTION_FINISH_TIME ] !== null) { |
|
| 78 | + if ($meta[RequestExecutorInterface::META_CONNECTION_FINISH_TIME] !== null) { |
|
| 79 | 79 | $this->callSocketSubscribers($operation, $event); |
| 80 | 80 | } |
| 81 | 81 | } catch (SocketException $e) { |
@@ -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 | } |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | public function processStage(array $operations) |
| 25 | 25 | { |
| 26 | 26 | /** @var OperationMetadata[] $operations */ |
| 27 | - $result = [ ]; |
|
| 27 | + $result = []; |
|
| 28 | 28 | $microTime = microtime(true); |
| 29 | 29 | foreach ($operations as $key => $operation) { |
| 30 | 30 | if ($this->isSingleSocketTimeout($operation, $microTime)) { |
@@ -53,8 +53,7 @@ discard block |
||
| 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); |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | private function isDescriptorActive(OperationMetadata $descriptor) |
| 54 | 54 | { |
| 55 | 55 | $meta = $descriptor->getMetadata(); |
| 56 | - return !$meta[ RequestExecutorInterface::META_REQUEST_COMPLETE ] && |
|
| 56 | + return !$meta[RequestExecutorInterface::META_REQUEST_COMPLETE] && |
|
| 57 | 57 | $descriptor->isRunning() && |
| 58 | 58 | !$descriptor->isPostponed(); |
| 59 | 59 | } |
@@ -41,8 +41,7 @@ discard block |
||
| 41 | 41 | { |
| 42 | 42 | $meta = $operation->getMetadata(); |
| 43 | 43 | return !$this->hasConnected($operation) ? |
| 44 | - $meta[ RequestExecutorInterface::META_CONNECTION_TIMEOUT ] : |
|
| 45 | - $meta[ RequestExecutorInterface::META_IO_TIMEOUT ]; |
|
| 44 | + $meta[RequestExecutorInterface::META_CONNECTION_TIMEOUT] : $meta[RequestExecutorInterface::META_IO_TIMEOUT]; |
|
| 46 | 45 | } |
| 47 | 46 | |
| 48 | 47 | /** |
@@ -56,8 +55,7 @@ discard block |
||
| 56 | 55 | { |
| 57 | 56 | $meta = $operation->getMetadata(); |
| 58 | 57 | return !$this->hasConnected($operation) ? |
| 59 | - $meta[ RequestExecutorInterface::META_CONNECTION_START_TIME ] : |
|
| 60 | - $meta[ RequestExecutorInterface::META_LAST_IO_START_TIME ]; |
|
| 58 | + $meta[RequestExecutorInterface::META_CONNECTION_START_TIME] : $meta[RequestExecutorInterface::META_LAST_IO_START_TIME]; |
|
| 61 | 59 | } |
| 62 | 60 | |
| 63 | 61 | /** |
@@ -74,7 +72,7 @@ discard block |
||
| 74 | 72 | $meta = $operationMetadata->getMetadata(); |
| 75 | 73 | $table = [ |
| 76 | 74 | RequestExecutorInterface::META_CONNECTION_START_TIME => |
| 77 | - $meta[ RequestExecutorInterface::META_CONNECTION_START_TIME ] === null, |
|
| 75 | + $meta[RequestExecutorInterface::META_CONNECTION_START_TIME] === null, |
|
| 78 | 76 | |
| 79 | 77 | RequestExecutorInterface::META_CONNECTION_FINISH_TIME => |
| 80 | 78 | $meta[RequestExecutorInterface::META_CONNECTION_FINISH_TIME] === null, |