@@ -75,15 +75,13 @@ |
||
75 | 75 | { |
76 | 76 | switch ($type) { |
77 | 77 | case self::SOCKET_CLIENT: |
78 | - $isPersistent = isset($options[ self::SOCKET_OPTION_IS_PERSISTENT ]) && |
|
79 | - $options[ self::SOCKET_OPTION_IS_PERSISTENT ]; |
|
80 | - $persistentKey = isset($options[ self::SOCKET_OPTION_PERSISTENT_KEY ]) ? |
|
81 | - $options[ self::SOCKET_OPTION_PERSISTENT_KEY ] : |
|
82 | - null; |
|
78 | + $isPersistent = isset($options[self::SOCKET_OPTION_IS_PERSISTENT]) && |
|
79 | + $options[self::SOCKET_OPTION_IS_PERSISTENT]; |
|
80 | + $persistentKey = isset($options[self::SOCKET_OPTION_PERSISTENT_KEY]) ? |
|
81 | + $options[self::SOCKET_OPTION_PERSISTENT_KEY] : null; |
|
83 | 82 | |
84 | 83 | return $isPersistent ? |
85 | - new PersistentClientSocket($persistentKey) : |
|
86 | - new ClientSocket(); |
|
84 | + new PersistentClientSocket($persistentKey) : new ClientSocket(); |
|
87 | 85 | case self::SOCKET_SERVER: |
88 | 86 | return new ServerSocket(); |
89 | 87 | default: |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Async sockets |
|
4 | - * |
|
5 | - * @copyright Copyright (c) 2015, Efimov Evgenij <[email protected]> |
|
6 | - * |
|
7 | - * This source file is subject to the MIT license that is bundled |
|
8 | - * with this source code in the file LICENSE. |
|
9 | - */ |
|
3 | + * Async sockets |
|
4 | + * |
|
5 | + * @copyright Copyright (c) 2015, Efimov Evgenij <[email protected]> |
|
6 | + * |
|
7 | + * This source file is subject to the MIT license that is bundled |
|
8 | + * with this source code in the file LICENSE. |
|
9 | + */ |
|
10 | 10 | namespace AsyncSockets\RequestExecutor\Pipeline; |
11 | 11 | |
12 | 12 | use AsyncSockets\Event\EventType; |
@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | feof($socket->getStreamResource()) !== false || |
78 | 78 | !stream_socket_get_name($socket->getStreamResource(), true) |
79 | 79 | ) |
80 | - ) || ( |
|
80 | + ) || ( |
|
81 | 81 | !($socket instanceof PersistentClientSocket) |
82 | - ); |
|
82 | + ); |
|
83 | 83 | |
84 | 84 | if (!$isTimeToLeave) { |
85 | 85 | return; |
@@ -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); |
@@ -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([ $operationMetadata ]); |
|
171 | + $result = $this->ioStage->processStage([$operationMetadata]); |
|
172 | 172 | $doResetEvent = empty($result); |
173 | 173 | |
174 | 174 | break; |
@@ -29,7 +29,7 @@ |
||
29 | 29 | return new self( |
30 | 30 | $socket, |
31 | 31 | sprintf( |
32 | - 'System has detected a zombie connection %s and closed it. '. |
|
32 | + 'System has detected a zombie connection %s and closed it. ' . |
|
33 | 33 | 'If you see this message it means that application ' . |
34 | 34 | 'has lost control on one of its sockets.', |
35 | 35 | (string) $socket |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Async sockets |
|
4 | - * |
|
5 | - * @copyright Copyright (c) 2016, Efimov Evgenij <[email protected]> |
|
6 | - * |
|
7 | - * This source file is subject to the MIT license that is bundled |
|
8 | - * with this source code in the file LICENSE. |
|
9 | - */ |
|
3 | + * Async sockets |
|
4 | + * |
|
5 | + * @copyright Copyright (c) 2016, Efimov Evgenij <[email protected]> |
|
6 | + * |
|
7 | + * This source file is subject to the MIT license that is bundled |
|
8 | + * with this source code in the file LICENSE. |
|
9 | + */ |
|
10 | 10 | namespace AsyncSockets\Operation; |
11 | 11 | |
12 | 12 | /** |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Async sockets |
|
4 | - * |
|
5 | - * @copyright Copyright (c) 2016, Efimov Evgenij <[email protected]> |
|
6 | - * |
|
7 | - * This source file is subject to the MIT license that is bundled |
|
8 | - * with this source code in the file LICENSE. |
|
9 | - */ |
|
3 | + * Async sockets |
|
4 | + * |
|
5 | + * @copyright Copyright (c) 2016, Efimov Evgenij <[email protected]> |
|
6 | + * |
|
7 | + * This source file is subject to the MIT license that is bundled |
|
8 | + * with this source code in the file LICENSE. |
|
9 | + */ |
|
10 | 10 | namespace AsyncSockets\Operation; |
11 | 11 | |
12 | 12 | /** |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Async sockets |
|
4 | - * |
|
5 | - * @copyright Copyright (c) 2016, Efimov Evgenij <[email protected]> |
|
6 | - * |
|
7 | - * This source file is subject to the MIT license that is bundled |
|
8 | - * with this source code in the file LICENSE. |
|
9 | - */ |
|
3 | + * Async sockets |
|
4 | + * |
|
5 | + * @copyright Copyright (c) 2016, Efimov Evgenij <[email protected]> |
|
6 | + * |
|
7 | + * This source file is subject to the MIT license that is bundled |
|
8 | + * with this source code in the file LICENSE. |
|
9 | + */ |
|
10 | 10 | namespace AsyncSockets\Operation; |
11 | 11 | |
12 | 12 | /** |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Async sockets |
|
4 | - * |
|
5 | - * @copyright Copyright (c) 2016, Efimov Evgenij <[email protected]> |
|
6 | - * |
|
7 | - * This source file is subject to the MIT license that is bundled |
|
8 | - * with this source code in the file LICENSE. |
|
9 | - */ |
|
3 | + * Async sockets |
|
4 | + * |
|
5 | + * @copyright Copyright (c) 2016, Efimov Evgenij <[email protected]> |
|
6 | + * |
|
7 | + * This source file is subject to the MIT license that is bundled |
|
8 | + * with this source code in the file LICENSE. |
|
9 | + */ |
|
10 | 10 | namespace AsyncSockets\Operation; |
11 | 11 | |
12 | 12 | /** |