@@ -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 |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | |
211 | 211 | $ms = $this->appendPayloadToRequest($ms); |
212 | 212 | |
213 | - if (! $this->isConnected()) { |
|
213 | + if (!$this->isConnected()) { |
|
214 | 214 | $this->connect(); |
215 | 215 | } |
216 | 216 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | */ |
236 | 236 | private function checkConnection($start): bool |
237 | 237 | { |
238 | - if (! $this->ready()) { |
|
238 | + if (!$this->ready()) { |
|
239 | 239 | if (time() - $start > $this->timeout) { |
240 | 240 | $this->disconnect(); |
241 | 241 | throw new HttpException("Connection timed out!"); |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | $numBytes = 1; |
343 | 343 | $start = time(); |
344 | 344 | while (true) { |
345 | - if (! $this->checkConnection($start)) { |
|
345 | + if (!$this->checkConnection($start)) { |
|
346 | 346 | continue; |
347 | 347 | } |
348 | 348 | |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | $start = time(); // we have readen something => adjust timeout start point |
356 | 356 | $tmp .= $c; |
357 | 357 | |
358 | - if (! $delimiterFound) { |
|
358 | + if (!$delimiterFound) { |
|
359 | 359 | $this->handleHeader($delimiterFound, $numBytes, $tmp); |
360 | 360 | } |
361 | 361 | |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | 'rqtype' => $requestType, |
438 | 438 | 'path' => $this->path, |
439 | 439 | 'proto' => $this->protocol, |
440 | - 'query' => (strlen($this->queryString) ? '?' . $this->queryString : '') |
|
440 | + 'query' => (strlen($this->queryString) ? '?'.$this->queryString : '') |
|
441 | 441 | )); |
442 | 442 | |
443 | 443 | // Add the host part |
@@ -483,23 +483,23 @@ discard block |
||
483 | 483 | */ |
484 | 484 | private function adjustHeaders($requestType) |
485 | 485 | { |
486 | - if (! array_key_exists('Accept', $this->headers) && $requestType != 'HEAD') { |
|
486 | + if (!array_key_exists('Accept', $this->headers) && $requestType != 'HEAD') { |
|
487 | 487 | $this->setHeader('Accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'); |
488 | 488 | } |
489 | 489 | |
490 | - if (! array_key_exists('Accept-Language', $this->headers) && $requestType != 'HEAD') { |
|
490 | + if (!array_key_exists('Accept-Language', $this->headers) && $requestType != 'HEAD') { |
|
491 | 491 | $this->setHeader('Accept-Language', 'en-US;q=0.7,en;q=0.3'); |
492 | 492 | } |
493 | 493 | |
494 | - if (! array_key_exists('User-Agent', $this->headers) && $requestType != 'HEAD') { |
|
494 | + if (!array_key_exists('User-Agent', $this->headers) && $requestType != 'HEAD') { |
|
495 | 495 | $this->setHeader('User-Agent', 'phpGenerics 1.0'); |
496 | 496 | } |
497 | 497 | |
498 | - if (! array_key_exists('Connection', $this->headers) || strlen($this->headers['Connection']) == 0) { |
|
498 | + if (!array_key_exists('Connection', $this->headers) || strlen($this->headers['Connection']) == 0) { |
|
499 | 499 | $this->adjustConnectionHeader($requestType); |
500 | 500 | } |
501 | 501 | |
502 | - if (! array_key_exists('Accept-Encoding', $this->headers)) { |
|
502 | + if (!array_key_exists('Accept-Encoding', $this->headers)) { |
|
503 | 503 | $encoding = ""; |
504 | 504 | if (function_exists('gzinflate')) { |
505 | 505 | $encoding = 'gzip, deflate'; |
@@ -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 |
@@ -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 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public function connect() |
50 | 50 | { |
51 | - if (! @socket_connect($this->handle, $this->endpoint->getAddress(), $this->endpoint->getPort())) { |
|
51 | + if (!@socket_connect($this->handle, $this->endpoint->getAddress(), $this->endpoint->getPort())) { |
|
52 | 52 | $code = socket_last_error($this->handle); |
53 | 53 | throw new SocketException(socket_strerror($code), array(), $code); |
54 | 54 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function disconnect() |
64 | 64 | { |
65 | - if (! $this->conntected) { |
|
65 | + if (!$this->conntected) { |
|
66 | 66 | throw new SocketException("Socket is not connected"); |
67 | 67 | } |
68 | 68 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | */ |
97 | 97 | public function isWriteable():bool |
98 | 98 | { |
99 | - if (! $this->isConnected()) { |
|
99 | + if (!$this->isConnected()) { |
|
100 | 100 | return false; |
101 | 101 | } |
102 | 102 |