@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | public function isEmpty($filter = null) |
| 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() |
| 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) |
| 182 | 182 | { |
| 183 | - if (! $this->exists()) { |
|
| 183 | + if (!$this->exists()) { |
|
| 184 | 184 | return false; |
| 185 | 185 | } |
| 186 | 186 | |
@@ -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 | /** |
@@ -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() |
| 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() |
| 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 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | public function close() |
| 83 | 83 | { |
| 84 | - if (! $this->conntected) { |
|
| 84 | + if (!$this->conntected) { |
|
| 85 | 85 | throw new SocketException("Socket is not connected"); |
| 86 | 86 | } |
| 87 | 87 | |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | public function isWriteable() |
| 98 | 98 | { |
| 99 | - if (! $this->isConnected()) { |
|
| 99 | + if (!$this->isConnected()) { |
|
| 100 | 100 | return false; |
| 101 | 101 | } |
| 102 | 102 | |
@@ -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)) { |
@@ -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; |