@@ -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 | ); |
@@ -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); |
@@ -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 | |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | protected function createSocketResource($address, $context) |
| 41 | 41 | { |
| 42 | 42 | $resource = stream_socket_client( |
| 43 | - $address . ($this->persistentKey ? '/' . $this->persistentKey : ''), |
|
| 43 | + $address.($this->persistentKey ? '/'.$this->persistentKey : ''), |
|
| 44 | 44 | $errno, |
| 45 | 45 | $errstr, |
| 46 | 46 | null, |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | parent::__construct($socket, 0); |
| 36 | 36 | if ($remoteAddress) { |
| 37 | 37 | $components = parse_url($remoteAddress); |
| 38 | - $this->remoteAddress = $components['host'] . ':' . $components['port']; |
|
| 38 | + $this->remoteAddress = $components['host'].':'.$components['port']; |
|
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | |
@@ -211,9 +211,9 @@ |
||
| 211 | 211 | private function onEvent(LeEvent $event, $eventFlags) |
| 212 | 212 | { |
| 213 | 213 | $map = [ |
| 214 | - LeCallbackInterface::EVENT_READ => [ EV_READ, RequestDescriptor::RDS_READ ], |
|
| 215 | - LeCallbackInterface::EVENT_WRITE => [ EV_WRITE, RequestDescriptor::RDS_WRITE ], |
|
| 216 | - LeCallbackInterface::EVENT_TIMEOUT => [ EV_TIMEOUT, 0 ], |
|
| 214 | + LeCallbackInterface::EVENT_READ => [EV_READ, RequestDescriptor::RDS_READ], |
|
| 215 | + LeCallbackInterface::EVENT_WRITE => [EV_WRITE, RequestDescriptor::RDS_WRITE], |
|
| 216 | + LeCallbackInterface::EVENT_TIMEOUT => [EV_TIMEOUT, 0], |
|
| 217 | 217 | ]; |
| 218 | 218 | |
| 219 | 219 | $descriptor = $event->getRequestDescriptor(); |
@@ -108,8 +108,7 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | private function calculateAttemptsCount($seconds, $usec) |
| 110 | 110 | { |
| 111 | - $result = $seconds !== null ? ceil(($seconds * 1E6 + $usec) / self::ATTEMPT_DELAY) : |
|
| 112 | - self::ATTEMPT_COUNT_FOR_INFINITE_TIMEOUT; |
|
| 111 | + $result = $seconds !== null ? ceil(($seconds * 1E6 + $usec) / self::ATTEMPT_DELAY) : self::ATTEMPT_COUNT_FOR_INFINITE_TIMEOUT; |
|
| 113 | 112 | if ($result < self::ATTEMPT_COUNT_FOR_INFINITE_TIMEOUT) { |
| 114 | 113 | $result = self::ATTEMPT_COUNT_FOR_INFINITE_TIMEOUT; |
| 115 | 114 | } |
@@ -328,8 +327,8 @@ discard block |
||
| 328 | 327 | */ |
| 329 | 328 | public function removeAllSocketOperations(StreamResourceInterface $streamResource) |
| 330 | 329 | { |
| 331 | - $opList = [ OperationInterface::OPERATION_READ, |
|
| 332 | - OperationInterface::OPERATION_WRITE ]; |
|
| 330 | + $opList = [OperationInterface::OPERATION_READ, |
|
| 331 | + OperationInterface::OPERATION_WRITE]; |
|
| 333 | 332 | |
| 334 | 333 | foreach ($opList as $op) { |
| 335 | 334 | $this->removeSocketOperation($streamResource, $op); |