@@ -49,19 +49,19 @@ discard block |
||
49 | 49 | $path = $params[0]; |
50 | 50 | |
51 | 51 | // Check if the path ends with dir separator. |
52 | - if (! Str::endsWith($path, '/')) { |
|
52 | + if (!Str::endsWith($path, '/')) { |
|
53 | 53 | $path .= '/'; |
54 | 54 | } |
55 | 55 | |
56 | 56 | // Check if it's a directory. |
57 | - if (! File::isDirectory($path)) { |
|
57 | + if (!File::isDirectory($path)) { |
|
58 | 58 | $this->echoOut('Folder does not exist: '.$path); |
59 | 59 | |
60 | 60 | return $this->returnValue(); |
61 | 61 | } |
62 | 62 | |
63 | 63 | // Check if we can write to it. |
64 | - if (! is_writable($path)) { |
|
64 | + if (!is_writable($path)) { |
|
65 | 65 | $this->echoOut('Folder is not writable: '.$path); |
66 | 66 | |
67 | 67 | return $this->returnValue(); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | // Check if the from date is the proper format. |
71 | 71 | if (isset($params[1]) && $params[1] !== '') { |
72 | - if (! $this->checkDate($params[1])) { |
|
72 | + if (!$this->checkDate($params[1])) { |
|
73 | 73 | return $this->returnValue(); |
74 | 74 | } |
75 | 75 | $fromDate = $params[1]; |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | // Check if the to date is the proper format. |
79 | 79 | if (isset($params[2]) && $params[2] !== '') { |
80 | - if (! $this->checkDate($params[2])) { |
|
80 | + if (!$this->checkDate($params[2])) { |
|
81 | 81 | return $this->returnValue(); |
82 | 82 | } |
83 | 83 | $toDate = $params[2]; |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | |
86 | 86 | // Check if the group_id exists. |
87 | 87 | if (isset($params[3]) && $params[3] !== 0) { |
88 | - if (! is_numeric($params[3])) { |
|
88 | + if (!is_numeric($params[3])) { |
|
89 | 89 | $this->echoOut('The group ID is not a number: '.$params[3]); |
90 | 90 | |
91 | 91 | return $this->returnValue(); |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | |
121 | 121 | // Create a path to store the new NZB files. |
122 | 122 | $currentPath = $path.$this->safeFilename($group['name']).'/'; |
123 | - if (! File::isDirectory($currentPath) && ! File::makeDirectory($currentPath) && ! File::isDirectory($currentPath)) { |
|
123 | + if (!File::isDirectory($currentPath) && !File::makeDirectory($currentPath) && !File::isDirectory($currentPath)) { |
|
124 | 124 | throw new \RuntimeException(sprintf('Directory "%s" was not created', $currentPath)); |
125 | 125 | } |
126 | 126 | foreach ($releases as $release) { |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | |
141 | 141 | // Check if the user wants them in gzip, copy it if so. |
142 | 142 | if ($gzip) { |
143 | - if (! copy($nzbFile, $currentFile.'.nzb.gz')) { |
|
143 | + if (!copy($nzbFile, $currentFile.'.nzb.gz')) { |
|
144 | 144 | if ($this->echoCLI) { |
145 | 145 | echo 'Unable to export NZB with GUID: '.$release['guid']; |
146 | 146 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | // If not, decompress it and create a file to store it in. |
151 | 151 | } else { |
152 | 152 | $nzbContents = Utility::unzipGzipFile($nzbFile); |
153 | - if (! $nzbContents) { |
|
153 | + if (!$nzbContents) { |
|
154 | 154 | if ($this->echoCLI) { |
155 | 155 | echo 'Unable to export NZB with GUID: '.$release['guid']; |
156 | 156 | } |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | |
191 | 191 | protected function checkDate($date): bool |
192 | 192 | { |
193 | - if (! preg_match('/^(\d{2}\/){2}\d{4}$/', $date)) { |
|
193 | + if (!preg_match('/^(\d{2}\/){2}\d{4}$/', $date)) { |
|
194 | 194 | $this->echoOut('Wrong date format: '.$date); |
195 | 195 | |
196 | 196 | return false; |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | use Symfony\Component\Process\Process; |
17 | 17 | use Zip as ZipStream; |
18 | 18 | |
19 | -if (! function_exists('getRawHtml')) { |
|
19 | +if (!function_exists('getRawHtml')) { |
|
20 | 20 | /** |
21 | 21 | * @param bool $cookie |
22 | 22 | * @return bool|mixed|string |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | } |
52 | 52 | } |
53 | 53 | |
54 | -if (! function_exists('makeFieldLinks')) { |
|
54 | +if (!function_exists('makeFieldLinks')) { |
|
55 | 55 | /** |
56 | 56 | * @return string |
57 | 57 | * |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | } |
82 | 82 | } |
83 | 83 | |
84 | -if (! function_exists('getUserBrowseOrder')) { |
|
84 | +if (!function_exists('getUserBrowseOrder')) { |
|
85 | 85 | /** |
86 | 86 | * @param string $orderBy |
87 | 87 | */ |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
110 | -if (! function_exists('getUserBrowseOrdering')) { |
|
110 | +if (!function_exists('getUserBrowseOrdering')) { |
|
111 | 111 | function getUserBrowseOrdering(): array |
112 | 112 | { |
113 | 113 | return [ |
@@ -137,21 +137,21 @@ discard block |
||
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
140 | -if (! function_exists('createGUID')) { |
|
140 | +if (!function_exists('createGUID')) { |
|
141 | 141 | /** |
142 | 142 | * @throws Exception |
143 | 143 | */ |
144 | 144 | function createGUID(): string |
145 | 145 | { |
146 | 146 | $data = random_bytes(16); |
147 | - $data[6] = \chr(\ord($data[6]) & 0x0F | 0x40); // set version to 0100 |
|
148 | - $data[8] = \chr(\ord($data[8]) & 0x3F | 0x80); // set bits 6-7 to 10 |
|
147 | + $data[6] = \chr(\ord($data[6]) & 0x0F|0x40); // set version to 0100 |
|
148 | + $data[8] = \chr(\ord($data[8]) & 0x3F|0x80); // set bits 6-7 to 10 |
|
149 | 149 | |
150 | 150 | return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(sodium_bin2hex($data), 4)); |
151 | 151 | } |
152 | 152 | } |
153 | 153 | |
154 | -if (! function_exists('getSimilarName')) { |
|
154 | +if (!function_exists('getSimilarName')) { |
|
155 | 155 | /** |
156 | 156 | * @param string $name |
157 | 157 | */ |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | } |
162 | 162 | } |
163 | 163 | |
164 | -if (! function_exists('color')) { |
|
164 | +if (!function_exists('color')) { |
|
165 | 165 | /** |
166 | 166 | * @param string $string |
167 | 167 | */ |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | } |
172 | 172 | } |
173 | 173 | |
174 | -if (! function_exists('human_filesize')) { |
|
174 | +if (!function_exists('human_filesize')) { |
|
175 | 175 | /** |
176 | 176 | * @param int $decimals |
177 | 177 | */ |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | } |
185 | 185 | } |
186 | 186 | |
187 | -if (! function_exists('bcdechex')) { |
|
187 | +if (!function_exists('bcdechex')) { |
|
188 | 188 | /** |
189 | 189 | * @return string |
190 | 190 | */ |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | } |
202 | 202 | } |
203 | 203 | |
204 | -if (! function_exists('runCmd')) { |
|
204 | +if (!function_exists('runCmd')) { |
|
205 | 205 | /** |
206 | 206 | * Run CLI command. |
207 | 207 | * |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | } |
230 | 230 | } |
231 | 231 | |
232 | -if (! function_exists('escapeString')) { |
|
232 | +if (!function_exists('escapeString')) { |
|
233 | 233 | /** |
234 | 234 | * @return string |
235 | 235 | */ |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | } |
240 | 240 | } |
241 | 241 | |
242 | -if (! function_exists('realDuration')) { |
|
242 | +if (!function_exists('realDuration')) { |
|
243 | 243 | /** |
244 | 244 | * @return string |
245 | 245 | */ |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | } |
252 | 252 | } |
253 | 253 | |
254 | -if (! function_exists('is_it_json')) { |
|
254 | +if (!function_exists('is_it_json')) { |
|
255 | 255 | /** |
256 | 256 | * @param array|string $isIt |
257 | 257 | * @return bool |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | return $zipped; |
295 | 295 | } |
296 | 296 | |
297 | -if (! function_exists('release_flag')) { |
|
297 | +if (!function_exists('release_flag')) { |
|
298 | 298 | // Function inspired by c0r3@newznabforums adds country flags on the browse page. |
299 | 299 | /** |
300 | 300 | * @param string $text Text to match against. |
@@ -430,10 +430,10 @@ discard block |
||
430 | 430 | |
431 | 431 | return ''; |
432 | 432 | } |
433 | - if (! function_exists('sanitize')) { |
|
433 | + if (!function_exists('sanitize')) { |
|
434 | 434 | function sanitize(array|string $phrases, array $doNotSanitize = []): string |
435 | 435 | { |
436 | - if (! is_array($phrases)) { |
|
436 | + if (!is_array($phrases)) { |
|
437 | 437 | $wordArray = explode(' ', str_replace('.', ' ', $phrases)); |
438 | 438 | } else { |
439 | 439 | $wordArray = $phrases; |
@@ -444,9 +444,9 @@ discard block |
||
444 | 444 | foreach ($wordArray as $words) { |
445 | 445 | $words = preg_split('/\s+/', $words); |
446 | 446 | foreach ($words as $st) { |
447 | - if (Str::startsWith($st, ['!', '+', '-', '?', '*']) && Str::length($st) > 1 && ! preg_match('/([!+?\-*]){2,}/', $st)) { |
|
447 | + if (Str::startsWith($st, ['!', '+', '-', '?', '*']) && Str::length($st) > 1 && !preg_match('/([!+?\-*]){2,}/', $st)) { |
|
448 | 448 | $str = $st; |
449 | - } elseif (Str::endsWith($st, ['+', '-', '?', '*']) && Str::length($st) > 1 && ! preg_match('/([!+?\-*]){2,}/', $st)) { |
|
449 | + } elseif (Str::endsWith($st, ['+', '-', '?', '*']) && Str::length($st) > 1 && !preg_match('/([!+?\-*]){2,}/', $st)) { |
|
450 | 450 | $str = $st; |
451 | 451 | } else { |
452 | 452 | $str = Sanitizer::escape($st, $doNotSanitize); |