@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public function __construct($file) |
| 51 | 51 | { |
| 52 | - if (! file_exists($file)) { |
|
| 52 | + if (!file_exists($file)) { |
|
| 53 | 53 | throw new FileNotFoundException("File {file} could not be found", array( |
| 54 | 54 | 'file' => $file |
| 55 | 55 | )); |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | $this->handle = fopen($file, "rb"); |
| 59 | 59 | |
| 60 | - if (! $this->ready()) { |
|
| 60 | + if (!$this->ready()) { |
|
| 61 | 61 | throw new StreamException("Could not open {file} for reading", array( |
| 62 | 62 | 'file' => $file |
| 63 | 63 | )); |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | public function ready(): bool |
| 103 | 103 | { |
| 104 | - return is_resource($this->handle) && ! feof($this->handle); |
|
| 104 | + return is_resource($this->handle) && !feof($this->handle); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | /** |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | public function read($length = 1, $offset = null): string |
| 113 | 113 | { |
| 114 | - if (! $this->ready()) { |
|
| 114 | + if (!$this->ready()) { |
|
| 115 | 115 | throw new StreamException("Stream is not ready!"); |
| 116 | 116 | } |
| 117 | 117 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | */ |
| 166 | 166 | public function unlock() |
| 167 | 167 | { |
| 168 | - if (! $this->locked || flock($this->handle, LOCK_UN) === false) { |
|
| 168 | + if (!$this->locked || flock($this->handle, LOCK_UN) === false) { |
|
| 169 | 169 | throw new LockException("Could not release lock"); |
| 170 | 170 | } |
| 171 | 171 | $this->locked = false; |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | setlocale(LC_ALL, "C"); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - for ($i = 32; $i < 256; $i ++) { |
|
| 56 | - if (($allowed == RandomString::ASCII && ! ctype_alnum(chr($i))) || (! ctype_print(chr($i)))) { |
|
| 55 | + for ($i = 32; $i < 256; $i++) { |
|
| 56 | + if (($allowed == RandomString::ASCII && !ctype_alnum(chr($i))) || (!ctype_print(chr($i)))) { |
|
| 57 | 57 | continue; |
| 58 | 58 | } |
| 59 | 59 | $allowedChars[] = $i; |
@@ -67,12 +67,12 @@ discard block |
||
| 67 | 67 | $i = $length; |
| 68 | 68 | while ($i > 0) { |
| 69 | 69 | $index = mt_rand(0, count($allowedChars) - 1); |
| 70 | - if (! $repeatable && in_array($index, $used)) { |
|
| 70 | + if (!$repeatable && in_array($index, $used)) { |
|
| 71 | 71 | continue; |
| 72 | 72 | } |
| 73 | 73 | $string .= chr($allowedChars[$index]); |
| 74 | 74 | $used[] = $i; |
| 75 | - $i --; |
|
| 75 | + $i--; |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | return $string; |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $localeData = explode(';', $localeSaved); |
| 90 | 90 | |
| 91 | 91 | foreach ($localeData as $identifier) { |
| 92 | - if (! strchr($identifier, '=')) { |
|
| 92 | + if (!strchr($identifier, '=')) { |
|
| 93 | 93 | continue; |
| 94 | 94 | } |
| 95 | 95 | $type = $value = null; |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | */ |
| 40 | 40 | public static function hasElement($array, $element): bool |
| 41 | 41 | { |
| 42 | - if (! is_array($array)) |
|
| 42 | + if (!is_array($array)) |
|
| 43 | 43 | return false; |
| 44 | 44 | |
| 45 | 45 | return isset($array[$element]) && strlen($array[$element]) > 0; |
@@ -39,8 +39,9 @@ |
||
| 39 | 39 | */ |
| 40 | 40 | public static function hasElement($array, $element): bool |
| 41 | 41 | { |
| 42 | - if (! is_array($array)) |
|
| 43 | - return false; |
|
| 42 | + if (! is_array($array)) { |
|
| 43 | + return false; |
|
| 44 | + } |
|
| 44 | 45 | |
| 45 | 46 | return isset($array[$element]) && strlen($array[$element]) > 0; |
| 46 | 47 | } |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | */ |
| 61 | 61 | public function get($key) |
| 62 | 62 | { |
| 63 | - if (! isset($_SESSION[$key])) { |
|
| 63 | + if (!isset($_SESSION[$key])) { |
|
| 64 | 64 | return null; |
| 65 | 65 | } |
| 66 | 66 | |
@@ -22,7 +22,8 @@ |
||
| 22 | 22 | * Create a new session provider |
| 23 | 23 | */ |
| 24 | 24 | public function __construct() |
| 25 | - {} |
|
| 25 | + { |
|
| 26 | +} |
|
| 26 | 27 | |
| 27 | 28 | /** |
| 28 | 29 | * Create session |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | |
| 197 | 197 | $ms = $this->appendPayloadToRequest($ms); |
| 198 | 198 | |
| 199 | - if (! $this->isConnected()) { |
|
| 199 | + if (!$this->isConnected()) { |
|
| 200 | 200 | $this->connect(); |
| 201 | 201 | } |
| 202 | 202 | |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | */ |
| 222 | 222 | private function checkConnection($start) |
| 223 | 223 | { |
| 224 | - if (! $this->ready()) { |
|
| 224 | + if (!$this->ready()) { |
|
| 225 | 225 | if (time() - $start > $this->timeout) { |
| 226 | 226 | $this->disconnect(); |
| 227 | 227 | throw new HttpException("Connection timed out!"); |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | $numBytes = 1; |
| 329 | 329 | $start = time(); |
| 330 | 330 | while (true) { |
| 331 | - if (! $this->checkConnection($start)) { |
|
| 331 | + if (!$this->checkConnection($start)) { |
|
| 332 | 332 | continue; |
| 333 | 333 | } |
| 334 | 334 | |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | $start = time(); // we have readen something => adjust timeout start point |
| 342 | 342 | $tmp .= $c; |
| 343 | 343 | |
| 344 | - if (! $delimiterFound) { |
|
| 344 | + if (!$delimiterFound) { |
|
| 345 | 345 | $this->handleHeader($delimiterFound, $numBytes, $tmp); |
| 346 | 346 | } |
| 347 | 347 | |
@@ -447,19 +447,19 @@ discard block |
||
| 447 | 447 | */ |
| 448 | 448 | private function adjustHeaders($requestType) |
| 449 | 449 | { |
| 450 | - if (! array_key_exists('Accept', $this->headers) && $requestType != 'HEAD') { |
|
| 450 | + if (!array_key_exists('Accept', $this->headers) && $requestType != 'HEAD') { |
|
| 451 | 451 | $this->setHeader('Accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'); |
| 452 | 452 | } |
| 453 | 453 | |
| 454 | - if (! array_key_exists('Accept-Language', $this->headers) && $requestType != 'HEAD') { |
|
| 454 | + if (!array_key_exists('Accept-Language', $this->headers) && $requestType != 'HEAD') { |
|
| 455 | 455 | $this->setHeader('Accept-Language', 'en-US;q=0.7,en;q=0.3'); |
| 456 | 456 | } |
| 457 | 457 | |
| 458 | - if (! array_key_exists('User-Agent', $this->headers) && $requestType != 'HEAD') { |
|
| 458 | + if (!array_key_exists('User-Agent', $this->headers) && $requestType != 'HEAD') { |
|
| 459 | 459 | $this->setHeader('User-Agent', 'phpGenerics 1.0'); |
| 460 | 460 | } |
| 461 | 461 | |
| 462 | - if (! array_key_exists('Connection', $this->headers) || strlen($this->headers['Connection']) == 0) { |
|
| 462 | + if (!array_key_exists('Connection', $this->headers) || strlen($this->headers['Connection']) == 0) { |
|
| 463 | 463 | $this->adjustConnectionHeader($requestType); |
| 464 | 464 | } |
| 465 | 465 | } |