@@ -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); |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | } |
20 | 20 | $binaries = new Binaries(['NNTP' => $nntp]); |
21 | 21 | |
22 | -if (isset($argv[1]) && ! is_numeric($argv[1])) { |
|
22 | +if (isset($argv[1]) && !is_numeric($argv[1])) { |
|
23 | 23 | $groupName = $argv[1]; |
24 | 24 | $colorCli->header("Updating group: $groupName"); |
25 | 25 | |
@@ -36,8 +36,7 @@ discard block |
||
36 | 36 | } |
37 | 37 | } else { |
38 | 38 | try { |
39 | - $binaries->updateAllGroups((isset($argv[1]) && is_numeric($argv[1]) && $argv[1] > 0 ? $argv[1] : |
|
40 | - $maxHeaders)); |
|
39 | + $binaries->updateAllGroups((isset($argv[1]) && is_numeric($argv[1]) && $argv[1] > 0 ? $argv[1] : $maxHeaders)); |
|
41 | 40 | } catch (Throwable $e) { |
42 | 41 | Illuminate\Support\Facades\Log::error($e->getMessage()); |
43 | 42 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | 'airdate', |
94 | 94 | 'episode_title', |
95 | 95 | ])->first(); |
96 | - if (! empty($result)) { |
|
96 | + if (!empty($result)) { |
|
97 | 97 | return $result->toArray(); |
98 | 98 | } |
99 | 99 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | $this->status = self::PROC_EXTFAIL; |
144 | 144 | } |
145 | 145 | |
146 | - if (! empty($hits['title'])) { |
|
146 | + if (!empty($hits['title'])) { |
|
147 | 147 | $hits['title'] = trim(str_replace(['_', '.'], ' ', $hits['title'])); |
148 | 148 | } |
149 | 149 | |
@@ -187,10 +187,10 @@ discard block |
||
187 | 187 | $anidbId = $this->getAnidbByName($tmpName); |
188 | 188 | } |
189 | 189 | |
190 | - if (! empty($anidbId) && is_numeric($anidbId->anidbid) && $anidbId->anidbid > 0) { |
|
190 | + if (!empty($anidbId) && is_numeric($anidbId->anidbid) && $anidbId->anidbid > 0) { |
|
191 | 191 | $updatedAni = $this->checkAniDBInfo($anidbId->anidbid, $cleanArr['epno']); |
192 | 192 | if (empty($updatedAni)) { |
193 | - if (! empty($this->updateTimeCheck($anidbId->anidbid))) { |
|
193 | + if (!empty($this->updateTimeCheck($anidbId->anidbid))) { |
|
194 | 194 | $this->padb->populateTable('info', $anidbId->anidbid); |
195 | 195 | $this->doRandomSleep(); |
196 | 196 | $updatedAni = $this->checkAniDBInfo($anidbId->anidbid); |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | */ |
154 | 154 | public function updatePreDb(array $parameters): void |
155 | 155 | { |
156 | - if (! empty($parameters)) { |
|
156 | + if (!empty($parameters)) { |
|
157 | 157 | $this->insertPredb($parameters); |
158 | 158 | } |
159 | 159 | } |
@@ -214,15 +214,15 @@ discard block |
||
214 | 214 | $resultData = []; |
215 | 215 | try { |
216 | 216 | $query = $this->search->setIndex($rt_index)->option('ranker', 'sph04')->option('sort_method', 'pq')->maxMatches(10000)->limit(10000)->sort('id', 'desc')->stripBadUtf8(true)->trackScores(true); |
217 | - if (! empty($searchArray)) { |
|
217 | + if (!empty($searchArray)) { |
|
218 | 218 | foreach ($searchArray as $key => $value) { |
219 | 219 | $query->search('@@relaxed @'.$key.' '.self::escapeString($value)); |
220 | 220 | } |
221 | - } elseif (! empty($searchString)) { |
|
221 | + } elseif (!empty($searchString)) { |
|
222 | 222 | // If $column is an array and has more than one item, implode it and wrap in parentheses. |
223 | - if (! empty($column) && \count($column) > 1) { |
|
223 | + if (!empty($column) && \count($column) > 1) { |
|
224 | 224 | $searchColumns = '@('.implode(',', $column).')'; |
225 | - } elseif (! empty($column) && \count($column) == 1) { // If $column is an array and has only one item, use as is. |
|
225 | + } elseif (!empty($column) && \count($column) == 1) { // If $column is an array and has only one item, use as is. |
|
226 | 226 | $searchColumns = '@'.$column[0]; |
227 | 227 | } else { |
228 | 228 | $searchColumns = ''; // Careful, this will search all columns. |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | public function beginImport($filesToProcess, bool $useNzbName = false, bool $delete = false, bool $deleteFailed = false): bool|string |
81 | 81 | { |
82 | 82 | // Get all the groups in the DB. |
83 | - if (! $this->getAllGroups()) { |
|
83 | + if (!$this->getAllGroups()) { |
|
84 | 84 | if ($this->browser) { |
85 | 85 | return $this->retVal; |
86 | 86 | } |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | gzwrite($fp, $nzbString); |
146 | 146 | gzclose($fp); |
147 | 147 | |
148 | - if (! File::isFile($path)) { |
|
148 | + if (!File::isFile($path)) { |
|
149 | 149 | $this->echoOut('ERROR: Problem compressing NZB file to: '.$path); |
150 | 150 | |
151 | 151 | // Remove the release. |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | if ($groupID === -1) { |
232 | 232 | if (array_key_exists($group, $this->allGroups)) { |
233 | 233 | $groupID = $this->allGroups[$group]; |
234 | - if (! $groupName) { |
|
234 | + if (!$groupName) { |
|
235 | 235 | $groupName = $group; |
236 | 236 | } |
237 | 237 | } else { |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | } |
266 | 266 | |
267 | 267 | // If we found a group and it's not blacklisted. |
268 | - if ($groupID !== -1 && ! $isBlackListed) { |
|
268 | + if ($groupID !== -1 && !$isBlackListed) { |
|
269 | 269 | // Get the size of the release. |
270 | 270 | if (\count($file->segments->segment) > 0) { |
271 | 271 | foreach ($file->segments->segment as $segment) { |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | $user = User::query()->where('email', '=', $payload['metadata']['buyerEmail'])->first(); |
106 | 106 | if ($user) { |
107 | 107 | $checkOrder = Payment::query()->where('invoice_id', '=', $payload['invoiceId'])->where('payment_status', '=', 'Settled')->first(); |
108 | - if (! empty($checkOrder)) { |
|
108 | + if (!empty($checkOrder)) { |
|
109 | 109 | Log::error('Duplicate BTCPay webhook: '.$payload['webhookId']); |
110 | 110 | |
111 | 111 | return response('Not Found', 404); |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | } elseif ($payload['type'] === 'InvoiceSettled') { |
135 | 135 | // Check if we have the invoice_id in payments table and if we do, update the user account |
136 | 136 | $checkOrder = Payment::query()->where('invoice_id', '=', $payload['invoiceId'])->where('payment_status', '=', 'Settled')->first(); |
137 | - if (! empty($checkOrder)) { |
|
137 | + if (!empty($checkOrder)) { |
|
138 | 138 | $user = User::query()->where('email', '=', $checkOrder->email)->first(); |
139 | 139 | if ($user) { |
140 | 140 | preg_match('/(?P<role>\w+(\s\+\+)?)[\s](?P<addYears>\d+)/i', $checkOrder->item_description, $matches); |
@@ -17,7 +17,7 @@ |
||
17 | 17 | public function handle(Request $request, Closure $next): Response |
18 | 18 | { |
19 | 19 | // Force Json accept type on api routes |
20 | - if ($request->is('api/*') && ! Str::contains($request->header('accept'), ['/json', '+json'])) { |
|
20 | + if ($request->is('api/*') && !Str::contains($request->header('accept'), ['/json', '+json'])) { |
|
21 | 21 | $request->headers->set('accept', 'application/json,'.$request->header('accept')); |
22 | 22 | } |
23 | 23 |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | protected function trailers(): mixed |
60 | 60 | { |
61 | 61 | $ret = $this->_html->find('a[itemprop=trailer]', 0); |
62 | - if (! empty($ret) && preg_match('/movieId=(?<movieid>\d+)&/', trim($ret->href), $hits)) { |
|
62 | + if (!empty($ret) && preg_match('/movieId=(?<movieid>\d+)&/', trim($ret->href), $hits)) { |
|
63 | 63 | $movieid = $hits['movieid']; |
64 | 64 | $this->_res['trailers']['url'] = self::AEBNSURL.self::TRAILERURL.$movieid; |
65 | 65 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $this->_res['genres'][] = trim($genre->plaintext); |
96 | 96 | } |
97 | 97 | } |
98 | - if (! empty($this->_res['genres'])) { |
|
98 | + if (!empty($this->_res['genres'])) { |
|
99 | 99 | $this->_res['genres'] = array_unique($this->_res['genres']); |
100 | 100 | } |
101 | 101 | |
@@ -109,13 +109,13 @@ discard block |
||
109 | 109 | { |
110 | 110 | $this->_res = []; |
111 | 111 | $ret = $this->_html->findOne('div.starsFull'); |
112 | - if (! $ret instanceof SimpleHtmlDomNodeBlank) { |
|
112 | + if (!$ret instanceof SimpleHtmlDomNodeBlank) { |
|
113 | 113 | foreach ($ret->find('span[itemprop=name]') as $star) { |
114 | 114 | $this->_res['cast'][] = trim($star->plaintext); |
115 | 115 | } |
116 | 116 | } else { |
117 | 117 | $ret = $this->_html->findOne('div.detailsLink'); |
118 | - if (! $ret instanceof SimpleHtmlDomNodeBlank) { |
|
118 | + if (!$ret instanceof SimpleHtmlDomNodeBlank) { |
|
119 | 119 | foreach ($ret->find('span') as $star) { |
120 | 120 | if (str_contains($star->plaintext, '/More/') && str_contains($star->plaintext, '/Stars/')) { |
121 | 121 | $this->_res['cast'][] = trim($star->plaintext); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | $videoDuration = $videoFormat = $videoCodec = $videoWidth = $videoHeight = $videoAspect = $videoFrameRate = $videoLibrary = $videoBitRate = ''; |
91 | 91 | |
92 | - if (! empty($videos)) { |
|
92 | + if (!empty($videos)) { |
|
93 | 93 | foreach ($videos as $video) { |
94 | 94 | if ($video->get('duration') !== null) { |
95 | 95 | $videoDuration = $video->get('duration')->getMilliseconds(); |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | $videoBitRate = $video->get('nominal_bit_rate')->getTextValue(); |
140 | 140 | } |
141 | 141 | |
142 | - if (! empty($videoBitRate)) { |
|
142 | + if (!empty($videoBitRate)) { |
|
143 | 143 | $overallBitRate = $videoBitRate; |
144 | 144 | } |
145 | 145 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | $audioID = 1; |
151 | 151 | $audioFormat = $audioMode = $audioBitRateMode = $audioBitRate = $audioChannels = $audioSampleRate = $audioLibrary = $audioLanguage = $audioTitle = ''; |
152 | 152 | |
153 | - if (! empty($audios)) { |
|
153 | + if (!empty($audios)) { |
|
154 | 154 | foreach ($audios as $audio) { |
155 | 155 | if ($audio->get('id') !== null) { |
156 | 156 | $audioID = $audio->get('id')->getFullName(); |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | } |
197 | 197 | } |
198 | 198 | |
199 | - if (! empty($subtitles)) { |
|
199 | + if (!empty($subtitles)) { |
|
200 | 200 | foreach ($subtitles as $subtitle) { |
201 | 201 | $subsID = 1; |
202 | 202 | $subsLanguage = 'Unknown'; |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | 'audiochannels' => \is_array($audioChannels) ? implode($audioChannels) : $audioChannels, |
261 | 261 | 'audiosamplerate' => \is_array($audioSampleRate) ? implode($audioSampleRate) : $audioSampleRate, |
262 | 262 | 'audiolibrary' => \is_array($audioLibrary) ? implode($audioLibrary) : $audioLibrary, |
263 | - 'audiolanguage' => ! empty($audioLanguage) ? $audioLanguage[1] : '', |
|
263 | + 'audiolanguage' => !empty($audioLanguage) ? $audioLanguage[1] : '', |
|
264 | 264 | 'audiotitle' => \is_array($audioTitle) ? implode($audioTitle) : $audioTitle, |
265 | 265 | ]); |
266 | 266 | } |
@@ -270,10 +270,10 @@ discard block |
||
270 | 270 | { |
271 | 271 | $ckid = ReleaseSubtitle::query()->where('releases_id', $releaseID)->where('subsid', '=', $subsID)->first(['releases_id']); |
272 | 272 | $subs = ''; |
273 | - if (! empty($subsLanguage)) { |
|
274 | - if (! empty($subsLanguage[1])) { |
|
273 | + if (!empty($subsLanguage)) { |
|
274 | + if (!empty($subsLanguage[1])) { |
|
275 | 275 | $subs = $subsLanguage[1]; |
276 | - } elseif (! empty($subsLanguage[0])) { |
|
276 | + } elseif (!empty($subsLanguage[0])) { |
|
277 | 277 | $subs = $subsLanguage[0]; |
278 | 278 | } |
279 | 279 | } |