@@ -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 | /** |
@@ -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 | /** |
@@ -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 | /** |
@@ -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 @@ |
||
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 | /** |
@@ -239,8 +239,8 @@ discard block |
||
239 | 239 | */ |
240 | 240 | public function removeAllSocketOperations(StreamResourceInterface $streamResource) |
241 | 241 | { |
242 | - $opList = [ OperationInterface::OPERATION_READ, |
|
243 | - OperationInterface::OPERATION_WRITE ]; |
|
242 | + $opList = [OperationInterface::OPERATION_READ, |
|
243 | + OperationInterface::OPERATION_WRITE]; |
|
244 | 244 | |
245 | 245 | foreach ($opList as $op) { |
246 | 246 | $this->removeSocketOperation($streamResource, $op); |
@@ -281,8 +281,7 @@ discard block |
||
281 | 281 | */ |
282 | 282 | private function calculateAttemptsCount($seconds, $usec) |
283 | 283 | { |
284 | - $result = $seconds !== null ? ceil(($seconds * 1E6 + $usec) / self::ATTEMPT_DELAY) : |
|
285 | - self::ATTEMPT_COUNT_FOR_INFINITE_TIMEOUT; |
|
284 | + $result = $seconds !== null ? ceil(($seconds * 1E6 + $usec) / self::ATTEMPT_DELAY) : self::ATTEMPT_COUNT_FOR_INFINITE_TIMEOUT; |
|
286 | 285 | if ($result < self::ATTEMPT_COUNT_FOR_INFINITE_TIMEOUT) { |
287 | 286 | $result = self::ATTEMPT_COUNT_FOR_INFINITE_TIMEOUT; |
288 | 287 | } |
@@ -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 | /** |
@@ -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 | /** |