@@ -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) { |
@@ -1,12 +1,12 @@ |
||
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\Exception; |
11 | 11 | |
12 | 12 | /** |
@@ -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 | } |
@@ -1,12 +1,12 @@ |
||
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\Exception; |
11 | 11 | |
12 | 12 | /** |
@@ -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 | /** |
@@ -1,12 +1,12 @@ |
||
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\Exception; |
11 | 11 | |
12 | 12 | /** |
@@ -155,7 +155,7 @@ |
||
155 | 155 | private function setConnectionFinishTime(OperationMetadata $operationMetadata) |
156 | 156 | { |
157 | 157 | $meta = $operationMetadata->getMetadata(); |
158 | - $wasConnected = $meta[ RequestExecutorInterface::META_CONNECTION_FINISH_TIME ] !== null; |
|
158 | + $wasConnected = $meta[RequestExecutorInterface::META_CONNECTION_FINISH_TIME] !== null; |
|
159 | 159 | $this->setSocketOperationTime($operationMetadata, RequestExecutorInterface::META_CONNECTION_FINISH_TIME); |
160 | 160 | if (!$wasConnected) { |
161 | 161 | $event = $this->createEvent($operationMetadata, EventType::CONNECTED); |
@@ -1,12 +1,12 @@ |
||
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\Exception; |
11 | 11 | |
12 | 12 | /** |
@@ -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 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | $this->setSocketOperationTime($item, RequestExecutorInterface::META_CONNECTION_START_TIME); |
139 | 139 | |
140 | 140 | $socket->open( |
141 | - $meta[ RequestExecutorInterface::META_ADDRESS ], |
|
141 | + $meta[RequestExecutorInterface::META_ADDRESS], |
|
142 | 142 | $this->getStreamContextFromMetaData($meta) |
143 | 143 | ); |
144 | 144 |
@@ -1,12 +1,12 @@ |
||
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\Exception; |
11 | 11 | |
12 | 12 | /** |
@@ -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; |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | |
58 | 58 | return ($desiredTimeout !== RequestExecutorInterface::WAIT_FOREVER) && |
59 | 59 | ( |
60 | - ($hasConnected && $lastOperationTime !== null) || |
|
60 | + ($hasConnected && $lastOperationTime !== null) || |
|
61 | 61 | !$hasConnected |
62 | - ) && |
|
62 | + ) && |
|
63 | 63 | ($microTime - $lastOperationTime >= $desiredTimeout) |
64 | - ; |
|
64 | + ; |
|
65 | 65 | } |
66 | 66 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | public function processStage(array $operations) |
24 | 24 | { |
25 | 25 | /** @var OperationMetadata[] $operations */ |
26 | - $result = [ ]; |
|
26 | + $result = []; |
|
27 | 27 | $microTime = microtime(true); |
28 | 28 | foreach ($operations as $key => $operation) { |
29 | 29 | if ($this->isSingleSocketTimeout($operation, $microTime)) { |
@@ -182,7 +182,7 @@ |
||
182 | 182 | $items = $this->socketBag->getItems(); |
183 | 183 | foreach ($this->connectStage->processStage($items) as $item) { |
184 | 184 | $meta = $item->getMetadata(); |
185 | - $this->setupEvent($item, $meta[ self::META_CONNECTION_TIMEOUT ]); |
|
185 | + $this->setupEvent($item, $meta[self::META_CONNECTION_TIMEOUT]); |
|
186 | 186 | } |
187 | 187 | } |
188 | 188 |
@@ -1,12 +1,12 @@ |
||
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\Exception; |
11 | 11 | |
12 | 12 | /** |
@@ -143,7 +143,7 @@ |
||
143 | 143 | $event->getHandle(), |
144 | 144 | $event->getOperationMetadata()->getSocket()->getStreamResource(), |
145 | 145 | $flags | $this->getEventFlags($event), |
146 | - function ($streamResource, $eventFlags, $eventKey) { |
|
146 | + function($streamResource, $eventFlags, $eventKey) { |
|
147 | 147 | if (isset($this->events[$eventKey])) { |
148 | 148 | $event = $this->events[$eventKey]; |
149 | 149 | $this->onEvent($event, $eventFlags); |
@@ -1,12 +1,12 @@ |
||
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\Exception; |
11 | 11 | |
12 | 12 | /** |
@@ -1,12 +1,12 @@ |
||
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\Exception; |
11 | 11 | |
12 | 12 | /** |