@@ -65,8 +65,6 @@ |
||
65 | 65 | /** |
66 | 66 | * Perform authentication |
67 | 67 | * |
68 | - * @param string $user The name the user provided |
|
69 | - * @param string $password The password the user provided |
|
70 | 68 | * @param string $file |
71 | 69 | * @throws GenericsException |
72 | 70 | * @return boolean |
@@ -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; |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function __construct($file) |
52 | 52 | { |
53 | - if (! file_exists($file)) { |
|
53 | + if (!file_exists($file)) { |
|
54 | 54 | throw new FileNotFoundException("File {file} could not be found", array( |
55 | 55 | 'file' => $file |
56 | 56 | )); |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | $this->handle = fopen($file, "rb"); |
60 | 60 | |
61 | - if (! $this->ready()) { |
|
61 | + if (!$this->ready()) { |
|
62 | 62 | throw new StreamException("Could not open {file} for reading", array( |
63 | 63 | 'file' => $file |
64 | 64 | )); |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | public function ready() |
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) |
113 | 113 | { |
114 | - if (! $this->ready()) { |
|
114 | + if (!$this->ready()) { |
|
115 | 115 | throw new StreamException("Stream is not ready!"); |
116 | 116 | } |
117 | 117 |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | */ |
224 | 224 | public function isLocked() |
225 | 225 | { |
226 | - return $this->locked; |
|
226 | + return $this->locked; |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | /** |
@@ -232,6 +232,6 @@ discard block |
||
232 | 232 | */ |
233 | 233 | public function isOpen() |
234 | 234 | { |
235 | - return is_resource($this->handle); |
|
235 | + return is_resource($this->handle); |
|
236 | 236 | } |
237 | 237 | } |
@@ -58,16 +58,16 @@ discard block |
||
58 | 58 | $mode = "wb"; |
59 | 59 | |
60 | 60 | if (file_exists($file)) { |
61 | - if (! $append) { |
|
61 | + if (!$append) { |
|
62 | 62 | throw new FileExistsException("File $file already exists!"); |
63 | 63 | } |
64 | 64 | |
65 | - if (! is_writable($file)) { |
|
65 | + if (!is_writable($file)) { |
|
66 | 66 | throw new NoAccessException("Cannot write to file $file"); |
67 | 67 | } |
68 | 68 | $mode = "ab"; |
69 | 69 | } else { |
70 | - if (! is_writable(dirname($file))) { |
|
70 | + if (!is_writable(dirname($file))) { |
|
71 | 71 | throw new NoAccessException("Cannot write to file {file}", array( |
72 | 72 | 'file' => $file |
73 | 73 | )); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | |
77 | 77 | $this->handle = fopen($file, $mode); |
78 | 78 | |
79 | - if (! $this->ready()) { |
|
79 | + if (!$this->ready()) { |
|
80 | 80 | throw new StreamException("Could not open {file} for writing", array( |
81 | 81 | 'file' => $file |
82 | 82 | )); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function write($buffer) |
118 | 118 | { |
119 | - if (! $this->ready()) { |
|
119 | + if (!$this->ready()) { |
|
120 | 120 | throw new StreamException("Stream is not open!"); |
121 | 121 | } |
122 | 122 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | */ |
159 | 159 | public function count() |
160 | 160 | { |
161 | - if (! $this->ready()) { |
|
161 | + if (!$this->ready()) { |
|
162 | 162 | throw new StreamException("Stream is not open!"); |
163 | 163 | } |
164 | 164 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | */ |
193 | 193 | public function flush() |
194 | 194 | { |
195 | - if (! $this->ready()) { |
|
195 | + if (!$this->ready()) { |
|
196 | 196 | throw new StreamException("Stream is not open!"); |
197 | 197 | } |
198 | 198 |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | */ |
224 | 224 | public function isLocked() |
225 | 225 | { |
226 | - return $this->locked; |
|
226 | + return $this->locked; |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | /** |
@@ -232,6 +232,6 @@ discard block |
||
232 | 232 | */ |
233 | 233 | public function isOpen() |
234 | 234 | { |
235 | - return is_resource($this->handle); |
|
235 | + return is_resource($this->handle); |
|
236 | 236 | } |
237 | 237 | } |
@@ -88,7 +88,7 @@ |
||
88 | 88 | { |
89 | 89 | clearstatcache(); |
90 | 90 | |
91 | - if (! file_exists($this->file)) { |
|
91 | + if (!file_exists($this->file)) { |
|
92 | 92 | return false; |
93 | 93 | } |
94 | 94 |
@@ -65,9 +65,9 @@ |
||
65 | 65 | */ |
66 | 66 | protected function logImpl($level, $message, array $context = array()) |
67 | 67 | { |
68 | - if (!$this->levelHasReached($level)) { |
|
69 | - return; |
|
70 | - } |
|
68 | + if (!$this->levelHasReached($level)) { |
|
69 | + return; |
|
70 | + } |
|
71 | 71 | |
72 | 72 | if ($this->isRotationNeeded()) { |
73 | 73 | unlink($this->file); |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | |
198 | 198 | $ms = $this->appendPayloadToRequest($ms); |
199 | 199 | |
200 | - if (! $this->isConnected()) { |
|
200 | + if (!$this->isConnected()) { |
|
201 | 201 | $this->connect(); |
202 | 202 | } |
203 | 203 | |
@@ -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!"); |
@@ -472,6 +472,6 @@ |
||
472 | 472 | */ |
473 | 473 | public function isOpen() |
474 | 474 | { |
475 | - return true; |
|
475 | + return true; |
|
476 | 476 | } |
477 | 477 | } |
@@ -29,10 +29,10 @@ |
||
29 | 29 | { |
30 | 30 | $parts = parse_url($url); |
31 | 31 | |
32 | - if (! isset($parts['host']) || strlen($parts['host']) == 0) { |
|
32 | + if (!isset($parts['host']) || strlen($parts['host']) == 0) { |
|
33 | 33 | throw new InvalidUrlException('This URL does not contain a host part'); |
34 | 34 | } |
35 | - if (! isset($parts['scheme']) || strlen($parts['scheme']) == 0) { |
|
35 | + if (!isset($parts['scheme']) || strlen($parts['scheme']) == 0) { |
|
36 | 36 | throw new InvalidUrlException('This URL does not contain a scheme part'); |
37 | 37 | } |
38 | 38 |
@@ -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; |
@@ -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 |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function __construct($path) |
32 | 32 | { |
33 | - $this->path = $this->fixDirectorySeparator($path); |
|
33 | + $this->path = $this->fixDirectorySeparator($path); |
|
34 | 34 | if ($this->exists()) { |
35 | 35 | $this->path = realpath($this->path); |
36 | 36 | } |
@@ -199,9 +199,9 @@ discard block |
||
199 | 199 | */ |
200 | 200 | private function fixDirectorySeparator($path) |
201 | 201 | { |
202 | - $path = str_replace("\\", DIRECTORY_SEPARATOR , $path); |
|
203 | - $path = str_replace("/", DIRECTORY_SEPARATOR, $path); |
|
202 | + $path = str_replace("\\", DIRECTORY_SEPARATOR , $path); |
|
203 | + $path = str_replace("/", DIRECTORY_SEPARATOR, $path); |
|
204 | 204 | |
205 | - return $path; |
|
205 | + return $path; |
|
206 | 206 | } |
207 | 207 | } |
@@ -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 | |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | */ |
200 | 200 | private function fixDirectorySeparator($path) |
201 | 201 | { |
202 | - $path = str_replace("\\", DIRECTORY_SEPARATOR , $path); |
|
202 | + $path = str_replace("\\", DIRECTORY_SEPARATOR, $path); |
|
203 | 203 | $path = str_replace("/", DIRECTORY_SEPARATOR, $path); |
204 | 204 | |
205 | 205 | return $path; |