@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | public function isEmpty($filter = null): bool |
| 50 | 50 | { |
| 51 | - if (! $this->exists()) { |
|
| 51 | + if (!$this->exists()) { |
|
| 52 | 52 | throw new DirectoryException("Directory {dir} does not exist", array( |
| 53 | 53 | 'dir' => $this->path |
| 54 | 54 | )); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | $iter = new \DirectoryIterator($this->path); |
| 58 | 58 | while ($iter->valid()) { |
| 59 | - if (! $iter->isDot() && ($filter === null || ! preg_match("/$filter/", $iter->getFilename()))) { |
|
| 59 | + if (!$iter->isDot() && ($filter === null || !preg_match("/$filter/", $iter->getFilename()))) { |
|
| 60 | 60 | return false; |
| 61 | 61 | } |
| 62 | 62 | $iter->next(); |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | public function remove($recursive = false) |
| 77 | 77 | { |
| 78 | - if (! $this->exists()) { |
|
| 78 | + if (!$this->exists()) { |
|
| 79 | 79 | return; |
| 80 | 80 | } |
| 81 | 81 | |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | return; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - if (! $recursive) { |
|
| 91 | + if (!$recursive) { |
|
| 92 | 92 | throw new DirectoryException("Directory {dir} is not empty", array( |
| 93 | 93 | 'dir' => $this->path |
| 94 | 94 | )); |
@@ -145,11 +145,11 @@ discard block |
||
| 145 | 145 | */ |
| 146 | 146 | public function exists(): bool |
| 147 | 147 | { |
| 148 | - if (! file_exists($this->path)) { |
|
| 148 | + if (!file_exists($this->path)) { |
|
| 149 | 149 | return false; |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - if (! is_dir($this->path)) { |
|
| 152 | + if (!is_dir($this->path)) { |
|
| 153 | 153 | throw new DirectoryException("Entry {path} exists, but it is not a directory!", array( |
| 154 | 154 | 'path' => $this->path |
| 155 | 155 | )); |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | */ |
| 181 | 181 | public function fileExists($fileName): bool |
| 182 | 182 | { |
| 183 | - if (! $this->exists()) { |
|
| 183 | + if (!$this->exists()) { |
|
| 184 | 184 | return false; |
| 185 | 185 | } |
| 186 | 186 | |
@@ -104,7 +104,8 @@ |
||
| 104 | 104 | if ($iter->isDir()) { |
| 105 | 105 | $dir = new Directory($iter->getPathname()); |
| 106 | 106 | $dir->remove(true); |
| 107 | - } else { |
|
| 107 | + } |
|
| 108 | + else { |
|
| 108 | 109 | unlink($iter->getPathname()); |
| 109 | 110 | } |
| 110 | 111 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | $this->handle = $clientHandle; |
| 37 | 37 | $this->conntected = false; |
| 38 | 38 | |
| 39 | - if (! is_resource($clientHandle)) { |
|
| 39 | + if (!is_resource($clientHandle)) { |
|
| 40 | 40 | parent::__construct($endpoint); |
| 41 | 41 | } |
| 42 | 42 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | if (!is_resource($this->handle)) { |
| 52 | 52 | throw new SocketException("Socket is not available"); |
| 53 | 53 | } |
| 54 | - if (! @socket_connect($this->handle, $this->endpoint->getAddress(), $this->endpoint->getPort())) { |
|
| 54 | + if (!@socket_connect($this->handle, $this->endpoint->getAddress(), $this->endpoint->getPort())) { |
|
| 55 | 55 | $code = socket_last_error($this->handle); |
| 56 | 56 | throw new SocketException(socket_strerror($code), array(), $code); |
| 57 | 57 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | public function disconnect() |
| 67 | 67 | { |
| 68 | - if (! $this->conntected) { |
|
| 68 | + if (!$this->conntected) { |
|
| 69 | 69 | throw new SocketException("Socket is not connected"); |
| 70 | 70 | } |
| 71 | 71 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | public function isWriteable():bool |
| 101 | 101 | { |
| 102 | - if (! $this->isConnected()) { |
|
| 102 | + if (!$this->isConnected()) { |
|
| 103 | 103 | return false; |
| 104 | 104 | } |
| 105 | 105 | |
@@ -234,7 +234,8 @@ |
||
| 234 | 234 | |
| 235 | 235 | if (is_dir($caPath)) { |
| 236 | 236 | $opts['ssl']['capath'] = $caPath; |
| 237 | - } else { |
|
| 237 | + } |
|
| 238 | + else { |
|
| 238 | 239 | $opts['ssl']['cafile'] = $caPath; |
| 239 | 240 | } |
| 240 | 241 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | public function read($length = 1, $offset = null): string |
| 62 | 62 | { |
| 63 | - return stream_get_contents($this->handle, $length, $offset === null ? - 1 : intval($offset)); |
|
| 63 | + return stream_get_contents($this->handle, $length, $offset === null ? -1 : intval($offset)); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public function isOpen(): bool |
| 72 | 72 | { |
| 73 | - return is_resource($this->handle) && ! feof($this->handle); |
|
| 73 | + return is_resource($this->handle) && !feof($this->handle); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | public function ready(): bool |
| 92 | 92 | { |
| 93 | - if (! is_resource($this->handle)) { |
|
| 93 | + if (!is_resource($this->handle)) { |
|
| 94 | 94 | return false; |
| 95 | 95 | } |
| 96 | 96 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | return false; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - if (! in_array($this->handle, $read)) { |
|
| 113 | + if (!in_array($this->handle, $read)) { |
|
| 114 | 114 | return false; |
| 115 | 115 | } |
| 116 | 116 | |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | */ |
| 170 | 170 | public function write($buffer) |
| 171 | 171 | { |
| 172 | - if(!$this->isWriteable()) { |
|
| 172 | + if (!$this->isWriteable()) { |
|
| 173 | 173 | throw new SocketException("Stream is not ready for writing"); |
| 174 | 174 | } |
| 175 | 175 | $len = strlen($buffer); |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | */ |
| 194 | 194 | public function isWriteable(): bool |
| 195 | 195 | { |
| 196 | - if (! is_resource($this->handle)) { |
|
| 196 | + if (!is_resource($this->handle)) { |
|
| 197 | 197 | return false; |
| 198 | 198 | } |
| 199 | 199 | |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | return false; |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | - if (! in_array($this->handle, $write)) { |
|
| 216 | + if (!in_array($this->handle, $write)) { |
|
| 217 | 217 | return false; |
| 218 | 218 | } |
| 219 | 219 | |
@@ -174,7 +174,8 @@ |
||
| 174 | 174 | if ($code != 0) { |
| 175 | 175 | if ($code != 10053) { |
| 176 | 176 | throw new SocketException(socket_strerror($code), array(), $code); |
| 177 | - } else { |
|
| 177 | + } |
|
| 178 | + else { |
|
| 178 | 179 | $this->handle = null; |
| 179 | 180 | } |
| 180 | 181 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | { |
| 55 | 55 | $this->handle = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP); |
| 56 | 56 | |
| 57 | - if (! is_resource($this->handle)) { |
|
| 57 | + if (!is_resource($this->handle)) { |
|
| 58 | 58 | $code = socket_last_error(); |
| 59 | 59 | throw new SocketException(socket_strerror($code), array(), $code); |
| 60 | 60 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | public function ready(): bool |
| 90 | 90 | { |
| 91 | - if (! is_resource($this->handle)) { |
|
| 91 | + if (!is_resource($this->handle)) { |
|
| 92 | 92 | return false; |
| 93 | 93 | } |
| 94 | 94 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | return false; |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - if (! in_array($this->handle, $read)) { |
|
| 112 | + if (!in_array($this->handle, $read)) { |
|
| 113 | 113 | return false; |
| 114 | 114 | } |
| 115 | 115 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | */ |
| 124 | 124 | public function isWriteable(): bool |
| 125 | 125 | { |
| 126 | - if (! is_resource($this->handle)) { |
|
| 126 | + if (!is_resource($this->handle)) { |
|
| 127 | 127 | return false; |
| 128 | 128 | } |
| 129 | 129 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | return false; |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | - if (! in_array($this->handle, $write)) { |
|
| 147 | + if (!in_array($this->handle, $write)) { |
|
| 148 | 148 | return false; |
| 149 | 149 | } |
| 150 | 150 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | $this->handle = $clientHandle; |
| 36 | 36 | $this->conntected = false; |
| 37 | 37 | |
| 38 | - if (! is_resource($clientHandle)) { |
|
| 38 | + if (!is_resource($clientHandle)) { |
|
| 39 | 39 | parent::__construct($endpoint); |
| 40 | 40 | } |
| 41 | 41 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | public function disconnect() |
| 59 | 59 | { |
| 60 | - if (! $this->conntected) { |
|
| 60 | + if (!$this->conntected) { |
|
| 61 | 61 | throw new SocketException("Socket is not connected"); |
| 62 | 62 | } |
| 63 | 63 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | public function isWriteable(): bool |
| 93 | 93 | { |
| 94 | - if (! $this->isConnected()) { |
|
| 94 | + if (!$this->isConnected()) { |
|
| 95 | 95 | return false; |
| 96 | 96 | } |
| 97 | 97 | |
@@ -68,7 +68,7 @@ |
||
| 68 | 68 | */ |
| 69 | 69 | public function get($key) |
| 70 | 70 | { |
| 71 | - if (! isset($this->sessionContainer[$key])) { |
|
| 71 | + if (!isset($this->sessionContainer[$key])) { |
|
| 72 | 72 | return null; |
| 73 | 73 | } |
| 74 | 74 | |
@@ -74,23 +74,23 @@ |
||
| 74 | 74 | */ |
| 75 | 75 | private function adjustHeaders($requestType) |
| 76 | 76 | { |
| 77 | - if (! array_key_exists('Accept', $this->headers) && $requestType != 'HEAD') { |
|
| 77 | + if (!array_key_exists('Accept', $this->headers) && $requestType != 'HEAD') { |
|
| 78 | 78 | $this->setHeader('Accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - if (! array_key_exists('Accept-Language', $this->headers) && $requestType != 'HEAD') { |
|
| 81 | + if (!array_key_exists('Accept-Language', $this->headers) && $requestType != 'HEAD') { |
|
| 82 | 82 | $this->setHeader('Accept-Language', 'en-US;q=0.7,en;q=0.3'); |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - if (! array_key_exists('User-Agent', $this->headers) && $requestType != 'HEAD') { |
|
| 85 | + if (!array_key_exists('User-Agent', $this->headers) && $requestType != 'HEAD') { |
|
| 86 | 86 | $this->setHeader('User-Agent', 'phpGenerics 1.0'); |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - if (! array_key_exists('Connection', $this->headers) || strlen($this->headers['Connection']) == 0) { |
|
| 89 | + if (!array_key_exists('Connection', $this->headers) || strlen($this->headers['Connection']) == 0) { |
|
| 90 | 90 | $this->adjustConnectionHeader($requestType); |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - if (! array_key_exists('Accept-Encoding', $this->headers)) { |
|
| 93 | + if (!array_key_exists('Accept-Encoding', $this->headers)) { |
|
| 94 | 94 | if (function_exists('gzinflate')) { |
| 95 | 95 | $encoding = 'gzip, deflate'; |
| 96 | 96 | } else { |
@@ -93,7 +93,8 @@ discard block |
||
| 93 | 93 | if (! array_key_exists('Accept-Encoding', $this->headers)) { |
| 94 | 94 | if (function_exists('gzinflate')) { |
| 95 | 95 | $encoding = 'gzip, deflate'; |
| 96 | - } else { |
|
| 96 | + } |
|
| 97 | + else { |
|
| 97 | 98 | $encoding = 'identity'; |
| 98 | 99 | } |
| 99 | 100 | $this->setHeader('Accept-Encoding', $encoding); |
@@ -110,7 +111,8 @@ discard block |
||
| 110 | 111 | { |
| 111 | 112 | if ($requestType == 'HEAD') { |
| 112 | 113 | $this->setHeader('Connection', 'close'); |
| 113 | - } else { |
|
| 114 | + } |
|
| 115 | + else { |
|
| 114 | 116 | $this->setHeader('Connection', 'keep-alive'); |
| 115 | 117 | } |
| 116 | 118 | } |
@@ -124,7 +126,8 @@ discard block |
||
| 124 | 126 | { |
| 125 | 127 | if (strpos($line, ':') === false) { |
| 126 | 128 | $this->responseCode = HttpStatus::parseStatus($line)->getCode(); |
| 127 | - } else { |
|
| 129 | + } |
|
| 130 | + else { |
|
| 128 | 131 | $line = trim($line); |
| 129 | 132 | list ($headerName, $headerValue) = explode(':', $line, 2); |
| 130 | 133 | $this->headers[$headerName] = trim($headerValue); |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | * @param bool $closing |
| 24 | 24 | * @return int |
| 25 | 25 | */ |
| 26 | - public function filter($in, $out, int &$consumed, bool $closing): int; |
|
| 26 | + public function filter($in, $out, int & $consumed, bool $closing): int; |
|
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | * Called when closing the filter |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | * {@inheritdoc} |
| 34 | 34 | * @see \Generics\Streams\Interceptor\StreamInterceptor::filter() |
| 35 | 35 | */ |
| 36 | - public function filter($in, $out, int &$consumed, bool $closing): int |
|
| 36 | + public function filter($in, $out, int & $consumed, bool $closing): int |
|
| 37 | 37 | { |
| 38 | 38 | if ($closing) { |
| 39 | 39 | return PSFS_FEED_ME; |