@@ -96,7 +96,7 @@ |
||
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | $httpStatus = new HttpStatus(401, '1.0'); |
| 99 | - header('WWW-Authenticate: Basic realm=' . $this->realm); |
|
| 99 | + header('WWW-Authenticate: Basic realm='.$this->realm); |
|
| 100 | 100 | header(sprintf('HTTP/%s', $httpStatus)); |
| 101 | 101 | echo "Forbidden!"; |
| 102 | 102 | return false; |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | |
| 31 | 31 | if ($context !== null) { |
| 32 | 32 | foreach ($context as $key => $val) { |
| 33 | - $replace['{' . $key . '}'] = $val; |
|
| 33 | + $replace['{'.$key.'}'] = $val; |
|
| 34 | 34 | } |
| 35 | 35 | } |
| 36 | 36 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | public function __construct(Endpoint $endpoint) |
| 27 | 27 | { |
| 28 | 28 | parent::__construct($endpoint); |
| 29 | - if (! @socket_set_option($this->handle, SOL_SOCKET, SO_REUSEADDR, 1)) { |
|
| 29 | + if (!@socket_set_option($this->handle, SOL_SOCKET, SO_REUSEADDR, 1)) { |
|
| 30 | 30 | $code = socket_last_error($this->handle); |
| 31 | 31 | throw new SocketException(socket_strerror($code), array(), $code); |
| 32 | 32 | } |
@@ -48,14 +48,14 @@ discard block |
||
| 48 | 48 | while ($runOn) { |
| 49 | 49 | $clientHandle = @socket_accept($this->handle); |
| 50 | 50 | |
| 51 | - if (! is_resource($clientHandle)) { |
|
| 51 | + if (!is_resource($clientHandle)) { |
|
| 52 | 52 | $code = socket_last_error($this->handle); |
| 53 | 53 | throw new SocketException(socket_strerror($code), array(), $code); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | $address = null; |
| 57 | 57 | $port = 0; |
| 58 | - if (! @socket_getpeername($clientHandle, $address, $port)) { |
|
| 58 | + if (!@socket_getpeername($clientHandle, $address, $port)) { |
|
| 59 | 59 | $code = socket_last_error($clientHandle); |
| 60 | 60 | throw new SocketException(socket_strerror($code), array(), $code); |
| 61 | 61 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | private function bind() |
| 75 | 75 | { |
| 76 | - if (! @socket_bind($this->handle, $this->endpoint->getAddress(), $this->endpoint->getPort())) { |
|
| 76 | + if (!@socket_bind($this->handle, $this->endpoint->getAddress(), $this->endpoint->getPort())) { |
|
| 77 | 77 | $code = socket_last_error($this->handle); |
| 78 | 78 | throw new SocketException(socket_strerror($code), array(), $code); |
| 79 | 79 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | private function listen() |
| 88 | 88 | { |
| 89 | - if (! @socket_listen($this->handle, 5)) { |
|
| 89 | + if (!@socket_listen($this->handle, 5)) { |
|
| 90 | 90 | $code = socket_last_error($this->handle); |
| 91 | 91 | throw new SocketException(socket_strerror($code), array(), $code); |
| 92 | 92 | } |
@@ -20,6 +20,9 @@ |
||
| 20 | 20 | trait ExceptionLoggerTrait |
| 21 | 21 | { |
| 22 | 22 | |
| 23 | + /** |
|
| 24 | + * @param string $message |
|
| 25 | + */ |
|
| 23 | 26 | abstract protected function logImpl($level, $message, array $context = array()); |
| 24 | 27 | |
| 25 | 28 | /** |
@@ -33,7 +33,8 @@ |
||
| 33 | 33 | |
| 34 | 34 | if ($ex instanceof ErrorException) { |
| 35 | 35 | $level = LogLevel::ERROR; |
| 36 | - } elseif ($ex instanceof RuntimeException) { |
|
| 36 | + } |
|
| 37 | + elseif ($ex instanceof RuntimeException) { |
|
| 37 | 38 | $level = LogLevel::EMERGENCY; |
| 38 | 39 | } |
| 39 | 40 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | protected function logImpl($level, $message, array $context = array()) |
| 67 | 67 | { |
| 68 | - if (! $this->levelHasReached($level)) { |
|
| 68 | + if (!$this->levelHasReached($level)) { |
|
| 69 | 69 | return; |
| 70 | 70 | } |
| 71 | 71 | |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | { |
| 91 | 91 | clearstatcache(); |
| 92 | 92 | |
| 93 | - if (! file_exists($this->file)) { |
|
| 93 | + if (!file_exists($this->file)) { |
|
| 94 | 94 | return false; |
| 95 | 95 | } |
| 96 | 96 | |
@@ -151,7 +151,7 @@ |
||
| 151 | 151 | if ($this->closed) { |
| 152 | 152 | throw new StreamException("Stream is not open"); |
| 153 | 153 | } |
| 154 | - if (! isset($this->memory)) { |
|
| 154 | + if (!isset($this->memory)) { |
|
| 155 | 155 | return 0; |
| 156 | 156 | } |
| 157 | 157 | return strlen($this->memory); |
@@ -72,16 +72,16 @@ discard block |
||
| 72 | 72 | $mode = "wb"; |
| 73 | 73 | |
| 74 | 74 | if (file_exists($file)) { |
| 75 | - if (! $append) { |
|
| 75 | + if (!$append) { |
|
| 76 | 76 | throw new FileExistsException("File $file already exists!"); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - if (! is_writable($file)) { |
|
| 79 | + if (!is_writable($file)) { |
|
| 80 | 80 | throw new NoAccessException("Cannot write to file $file"); |
| 81 | 81 | } |
| 82 | 82 | $mode = "ab"; |
| 83 | 83 | } else { |
| 84 | - if (! is_writable(dirname($file))) { |
|
| 84 | + if (!is_writable(dirname($file))) { |
|
| 85 | 85 | throw new NoAccessException("Cannot write to file {file}", array( |
| 86 | 86 | 'file' => $file |
| 87 | 87 | )); |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | $this->handle = fopen($file, $mode); |
| 92 | 92 | |
| 93 | - if (! $this->ready()) { |
|
| 93 | + if (!$this->ready()) { |
|
| 94 | 94 | throw new StreamException("Could not open {file} for writing", array( |
| 95 | 95 | 'file' => $file |
| 96 | 96 | )); |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | */ |
| 133 | 133 | public function write($buffer) |
| 134 | 134 | { |
| 135 | - if (! $this->ready()) { |
|
| 135 | + if (!$this->ready()) { |
|
| 136 | 136 | throw new StreamException("Stream is not open!"); |
| 137 | 137 | } |
| 138 | 138 | |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | */ |
| 175 | 175 | public function count(): int |
| 176 | 176 | { |
| 177 | - if (! $this->ready()) { |
|
| 177 | + if (!$this->ready()) { |
|
| 178 | 178 | throw new StreamException("Stream is not open!"); |
| 179 | 179 | } |
| 180 | 180 | |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | */ |
| 209 | 209 | public function flush() |
| 210 | 210 | { |
| 211 | - if (! $this->ready()) { |
|
| 211 | + if (!$this->ready()) { |
|
| 212 | 212 | throw new StreamException("Stream is not open!"); |
| 213 | 213 | } |
| 214 | 214 | |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | */ |
| 236 | 236 | public function unlock() |
| 237 | 237 | { |
| 238 | - if (! $this->locked || flock($this->handle, LOCK_UN) === false) { |
|
| 238 | + if (!$this->locked || flock($this->handle, LOCK_UN) === false) { |
|
| 239 | 239 | throw new LockException("Could not release lock"); |
| 240 | 240 | } |
| 241 | 241 | $this->locked = false; |
@@ -73,7 +73,7 @@ |
||
| 73 | 73 | |
| 74 | 74 | if (file_exists($file)) { |
| 75 | 75 | if (! $append) { |
| 76 | - throw new FileExistsException("File $file already exists!"); |
|
| 76 | + throw new FileExistsException("file $file already exists!"); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | if (! is_writable($file)) { |
@@ -80,7 +80,8 @@ discard block |
||
| 80 | 80 | throw new NoAccessException("Cannot write to file $file"); |
| 81 | 81 | } |
| 82 | 82 | $mode = "ab"; |
| 83 | - } else { |
|
| 83 | + } |
|
| 84 | + else { |
|
| 84 | 85 | if (! is_writable(dirname($file))) { |
| 85 | 86 | throw new NoAccessException("Cannot write to file {file}", array( |
| 86 | 87 | 'file' => $file |
@@ -145,7 +146,8 @@ discard block |
||
| 145 | 146 | throw new StreamException("Could not write memory stream into file"); |
| 146 | 147 | } |
| 147 | 148 | } |
| 148 | - } else { |
|
| 149 | + } |
|
| 150 | + else { |
|
| 149 | 151 | $buffer = strval($buffer); |
| 150 | 152 | if (fwrite($this->handle, $buffer) != strlen($buffer)) { |
| 151 | 153 | throw new StreamException("Could not write buffer into file"); |
@@ -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; |