@@ -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, |
@@ -137,7 +137,7 @@ |
||
| 137 | 137 | * @param OperationMetadata $operation Operation object |
| 138 | 138 | * @param double $microTime Current time with microseconds |
| 139 | 139 | * |
| 140 | - * @return double|null |
|
| 140 | + * @return double |
|
| 141 | 141 | */ |
| 142 | 142 | private function getSingleSocketTimeout(OperationMetadata $operation, $microTime) |
| 143 | 143 | { |
@@ -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 | } |
@@ -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); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | } elseif ($decision === LimitationSolverInterface::DECISION_SKIP_CURRENT) { |
| 57 | 57 | continue; |
| 58 | 58 | } elseif ($decision !== LimitationSolverInterface::DECISION_OK) { |
| 59 | - throw new \LogicException('Unknown decision ' . $decision . ' received.'); |
|
| 59 | + throw new \LogicException('Unknown decision '.$decision.' received.'); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | if ($this->connectSocket($descriptor)) { |
@@ -105,13 +105,13 @@ discard block |
||
| 105 | 105 | */ |
| 106 | 106 | private function getStreamContextFromMetaData($meta) |
| 107 | 107 | { |
| 108 | - $metaStreamContext = $meta[ RequestExecutorInterface::META_SOCKET_STREAM_CONTEXT ]; |
|
| 108 | + $metaStreamContext = $meta[RequestExecutorInterface::META_SOCKET_STREAM_CONTEXT]; |
|
| 109 | 109 | if (is_resource($metaStreamContext)) { |
| 110 | 110 | return $metaStreamContext; |
| 111 | 111 | } elseif (is_array($metaStreamContext)) { |
| 112 | 112 | return stream_context_create( |
| 113 | - isset($metaStreamContext[ 'options' ]) ? $metaStreamContext[ 'options' ] : [ ], |
|
| 114 | - isset($metaStreamContext[ 'params' ]) ? $metaStreamContext[ 'params' ] : [ ] |
|
| 113 | + isset($metaStreamContext['options']) ? $metaStreamContext['options'] : [], |
|
| 114 | + isset($metaStreamContext['params']) ? $metaStreamContext['params'] : [] |
|
| 115 | 115 | ); |
| 116 | 116 | } |
| 117 | 117 | |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | $meta = $descriptor->getMetadata(); |
| 140 | 140 | |
| 141 | 141 | $socket->open( |
| 142 | - $meta[ RequestExecutorInterface::META_ADDRESS ], |
|
| 142 | + $meta[RequestExecutorInterface::META_ADDRESS], |
|
| 143 | 143 | $this->getStreamContextFromMetaData($meta) |
| 144 | 144 | ); |
| 145 | 145 | |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | */ |
| 37 | 37 | public function __construct($data = null, $isOutOfBand = false) |
| 38 | 38 | { |
| 39 | - $this->data = $data !== null ? (string) $data : null; |
|
| 39 | + $this->data = $data !== null ? (string) $data : null; |
|
| 40 | 40 | $this->isOutOfBand = $isOutOfBand; |
| 41 | 41 | } |
| 42 | 42 | |
@@ -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 | ) |
@@ -74,19 +74,17 @@ |
||
| 74 | 74 | { |
| 75 | 75 | switch ($type) { |
| 76 | 76 | case self::SOCKET_CLIENT: |
| 77 | - $isPersistent = isset($options[ self::SOCKET_OPTION_IS_PERSISTENT ]) && |
|
| 78 | - $options[ self::SOCKET_OPTION_IS_PERSISTENT ]; |
|
| 79 | - $persistentKey = isset($options[ self::SOCKET_OPTION_PERSISTENT_KEY ]) ? |
|
| 80 | - $options[ self::SOCKET_OPTION_PERSISTENT_KEY ] : |
|
| 81 | - null; |
|
| 77 | + $isPersistent = isset($options[self::SOCKET_OPTION_IS_PERSISTENT]) && |
|
| 78 | + $options[self::SOCKET_OPTION_IS_PERSISTENT]; |
|
| 79 | + $persistentKey = isset($options[self::SOCKET_OPTION_PERSISTENT_KEY]) ? |
|
| 80 | + $options[self::SOCKET_OPTION_PERSISTENT_KEY] : null; |
|
| 82 | 81 | |
| 83 | 82 | return $isPersistent ? |
| 84 | - new PersistentClientSocket($persistentKey) : |
|
| 85 | - new ClientSocket(); |
|
| 83 | + new PersistentClientSocket($persistentKey) : new ClientSocket(); |
|
| 86 | 84 | case self::SOCKET_SERVER: |
| 87 | 85 | return new ServerSocket(); |
| 88 | 86 | default: |
| 89 | - throw new \InvalidArgumentException("Unexpected type {$type} used in " . __FUNCTION__); |
|
| 87 | + throw new \InvalidArgumentException("Unexpected type {$type} used in ".__FUNCTION__); |
|
| 90 | 88 | } |
| 91 | 89 | } |
| 92 | 90 | |