@@ -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, |
@@ -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 | } |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | protected function initializeRequest(EventCaller $eventCaller) |
| 105 | 105 | { |
| 106 | 106 | parent::initializeRequest($eventCaller); |
| 107 | - $this->base = new LeBase(); |
|
| 107 | + $this->base = new LeBase(); |
|
| 108 | 108 | |
| 109 | 109 | $this->connectStage = $this->stageFactory->createConnectStage($this, $eventCaller, $this->solver); |
| 110 | 110 | $this->ioStage = $this->stageFactory->createIoStage($this, $eventCaller); |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | protected function terminateRequest() |
| 118 | 118 | { |
| 119 | 119 | parent::terminateRequest(); |
| 120 | - $this->base = null; |
|
| 120 | + $this->base = null; |
|
| 121 | 121 | |
| 122 | 122 | $this->connectStage = null; |
| 123 | 123 | $this->ioStage = null; |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | case LeCallbackInterface::EVENT_READ: |
| 169 | 169 | // fall down |
| 170 | 170 | case LeCallbackInterface::EVENT_WRITE: |
| 171 | - $result = $this->ioStage->processStage([ $requestDescriptor ]); |
|
| 171 | + $result = $this->ioStage->processStage([$requestDescriptor]); |
|
| 172 | 172 | $doResetEvent = empty($result); |
| 173 | 173 | |
| 174 | 174 | break; |
@@ -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 | |