@@ -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 |
@@ -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 | /** |
@@ -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 |
@@ -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)) { |