Passed
Push — master ( ac3a7a...db8e4a )
by Darko
06:18
created
Blacklight/processing/tv/TVDB.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
                 }
142 142
 
143 143
                 if ((int) $videoId > 0 && (int) $tvDbId > 0) {
144
-                    if (! empty($tvdbShow['poster'])) { // Use TVDB poster if available
144
+                    if (!empty($tvdbShow['poster'])) { // Use TVDB poster if available
145 145
                         $this->getPoster($videoId);
146 146
                     } else { // Check Fanart.tv for poster
147 147
                         $poster = $this->fanart->getTVFanart($tvDbId);
@@ -151,8 +151,8 @@  discard block
 block discarded – undo
151 151
                         }
152 152
                     }
153 153
 
154
-                    $seasonNo = (! empty($release['season']) ? preg_replace('/^S0*/i', '', $release['season']) : '');
155
-                    $episodeNo = (! empty($release['episode']) ? preg_replace('/^E0*/i', '', $release['episode']) : '');
154
+                    $seasonNo = (!empty($release['season']) ? preg_replace('/^S0*/i', '', $release['season']) : '');
155
+                    $episodeNo = (!empty($release['episode']) ? preg_replace('/^E0*/i', '', $release['episode']) : '');
156 156
 
157 157
                     if ($episodeNo === 'all') {
158 158
                         // Set the video ID and leave episode 0
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
                     }
164 164
 
165 165
                     // Download all episodes if new show to reduce API/bandwidth usage
166
-                    if (! $this->countEpsByVideoID($videoId)) {
166
+                    if (!$this->countEpsByVideoID($videoId)) {
167 167
                         $this->getEpisodeInfo($tvDbId, -1, -1, $videoId);
168 168
                     }
169 169
 
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
                     }
258 258
 
259 259
                     // Check for show aliases and try match those too
260
-                    if (! empty($show->aliases)) {
260
+                    if (!empty($show->aliases)) {
261 261
                         foreach ($show->aliases as $key => $name) {
262 262
                             $matchPercent = $this->checkMatch(strtolower($name), strtolower($name), $matchPercent);
263 263
                             if ($matchPercent > $highestMatch) {
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
                     }
269 269
                 }
270 270
             }
271
-            if (! empty($highest)) {
271
+            if (!empty($highest)) {
272 272
                 $return = $this->formatShowInfo($highest);
273 273
             }
274 274
         }
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
             $poster = $this->client->series()->artworks($show->tvdb_id);
354 354
             // Grab the image with the highest score where type == 2
355 355
             $poster = collect($poster)->where('type', 2)->sortByDesc('score')->first();
356
-            $this->posterUrl = ! empty($poster->image) ? $poster->image : '';
356
+            $this->posterUrl = !empty($poster->image) ? $poster->image : '';
357 357
         } catch (ResourceNotFoundException $e) {
358 358
             $this->colorCli->climate()->error('Poster image not found on TVDB');
359 359
         }
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
             'tvrage' => 0,
380 380
             'tvmaze' => 0,
381 381
             'tmdb' => 0,
382
-            'aliases' => ! empty($show->aliases) ? $show->aliases : '',
382
+            'aliases' => !empty($show->aliases) ? $show->aliases : '',
383 383
             'localzone' => "''",
384 384
         ];
385 385
     }
Please login to merge, or discard this patch.
Blacklight/processing/adult/Hotmovies.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
     {
102 102
         $studio = false;
103 103
         $director = false;
104
-        if (($ret = $this->_html->find('div.page_video_info')) && ! empty($ret->find('text'))) {
104
+        if (($ret = $this->_html->find('div.page_video_info')) && !empty($ret->find('text'))) {
105 105
             foreach ($ret->find('text') as $e) {
106 106
                 $e = trim($e->plaintext);
107 107
                 $rArray = [',', '...', '&nbsp:'];
@@ -115,12 +115,12 @@  discard block
 block discarded – undo
115 115
                 }
116 116
                 if ($studio === true) {
117 117
                     if ((stripos($e, 'Custodian of Records') === false) && stripos($e, 'Description') === false) {
118
-                        if ($director === true && ! empty($e)) {
118
+                        if ($director === true && !empty($e)) {
119 119
                             $this->_res['director'] = $e;
120 120
                             $e = null;
121 121
                             $director = false;
122 122
                         }
123
-                        if (! empty($e)) {
123
+                        if (!empty($e)) {
124 124
                             $this->_res['productinfo'][] = $e;
125 125
                         }
126 126
                     } else {
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
                     $title = trim($ret->title);
209 209
                     $title = str_replace('/XXX/', '', $title);
210 210
                     $title = preg_replace('/\(.*?\)|[._-]/', ' ', $title);
211
-                    if (! empty($title)) {
211
+                    if (!empty($title)) {
212 212
                         similar_text($movie, $title, $p);
213 213
                         if ($p >= 90) {
214 214
                             $this->_title = $title;
Please login to merge, or discard this patch.
Blacklight/processing/adult/AEBN.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     protected function trailers(): mixed
65 65
     {
66 66
         $ret = $this->_html->find('a[itemprop=trailer]', 0);
67
-        if (! empty($ret) && preg_match('/movieId=(?<movieid>\d+)&/', trim($ret->href), $hits)) {
67
+        if (!empty($ret) && preg_match('/movieId=(?<movieid>\d+)&/', trim($ret->href), $hits)) {
68 68
             $movieid = $hits['movieid'];
69 69
             $this->_res['trailers']['url'] = self::AEBNSURL.self::TRAILERURL.$movieid;
70 70
         }
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
                 $this->_res['genres'][] = trim($genre->plaintext);
101 101
             }
102 102
         }
103
-        if (! empty($this->_res['genres'])) {
103
+        if (!empty($this->_res['genres'])) {
104 104
             $this->_res['genres'] = array_unique($this->_res['genres']);
105 105
         }
106 106
 
@@ -114,13 +114,13 @@  discard block
 block discarded – undo
114 114
     {
115 115
         $this->_res = [];
116 116
         $ret = $this->_html->findOne('div.starsFull');
117
-        if (! $ret instanceof SimpleHtmlDomNodeBlank) {
117
+        if (!$ret instanceof SimpleHtmlDomNodeBlank) {
118 118
             foreach ($ret->find('span[itemprop=name]') as $star) {
119 119
                 $this->_res['cast'][] = trim($star->plaintext);
120 120
             }
121 121
         } else {
122 122
             $ret = $this->_html->findOne('div.detailsLink');
123
-            if (! $ret instanceof SimpleHtmlDomNodeBlank) {
123
+            if (!$ret instanceof SimpleHtmlDomNodeBlank) {
124 124
                 foreach ($ret->find('span') as $star) {
125 125
                     if (strpos($star->plaintext, '/More/') !== false && strpos($star->plaintext, '/Stars/') !== false) {
126 126
                         $this->_res['cast'][] = trim($star->plaintext);
Please login to merge, or discard this patch.
Blacklight/processing/adult/Popporn.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
                 }
135 135
                 if ($country === true) {
136 136
                     if (stripos($e, 'addthis_config') === false) {
137
-                        if (! empty($e)) {
137
+                        if (!empty($e)) {
138 138
                             $this->_res['productinfo'][] = $e;
139 139
                         }
140 140
                     } else {
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
                             $e = null;
158 158
                         }
159 159
                         if ($features === true) {
160
-                            if (! empty($e)) {
160
+                            if (!empty($e)) {
161 161
                                 $this->_res['extras'][] = $e;
162 162
                             }
163 163
                         }
@@ -188,13 +188,13 @@  discard block
 block discarded – undo
188 188
                         $e = null;
189 189
                     }
190 190
 
191
-                    if (($director === true) && ! empty($e)) {
191
+                    if (($director === true) && !empty($e)) {
192 192
                         $this->_res['director'] = $e;
193 193
                         $director = false;
194 194
                         $e = null;
195 195
                     }
196 196
                     if (stripos($e, 'Country:') === false) {
197
-                        if (! empty($e)) {
197
+                        if (!empty($e)) {
198 198
                             $er[] = $e;
199 199
                         }
200 200
                     } else {
@@ -231,12 +231,12 @@  discard block
 block discarded – undo
231 231
      */
232 232
     public function processSite(string $movie): bool
233 233
     {
234
-        if (! empty($movie)) {
234
+        if (!empty($movie)) {
235 235
             $this->_trailUrl = self::TRAILINGSEARCH.$movie;
236 236
             $this->_response = getRawHtml(self::POPURL.$this->_trailUrl, $this->cookie);
237 237
             if ($this->_response !== false) {
238 238
                 if ($ret = $this->_html->loadHtml($this->_response)->find('div.product-info, div.title', 1)) {
239
-                    if (! empty($ret->plaintext)) {
239
+                    if (!empty($ret->plaintext)) {
240 240
                         $this->_title = trim($ret->plaintext);
241 241
                         $title = str_replace('XXX', '', $ret->plaintext);
242 242
                         $title = trim(preg_replace('/\(.*?\)|[._-]/i', ' ', $title));
Please login to merge, or discard this patch.
Blacklight/processing/adult/ADM.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
         foreach ($this->_html->find('h3') as $heading) {
126 126
             if (trim($heading->plaintext) === 'Cast') {
127 127
                 foreach ($heading->nextSibling() as $next) {
128
-                    if (! $next instanceof SimpleHtmlDomNodeBlank && $next->nodeName !== 'h3') {
128
+                    if (!$next instanceof SimpleHtmlDomNodeBlank && $next->nodeName !== 'h3') {
129 129
                         $next = $next->nextSibling();
130 130
                     }
131 131
                     if (preg_match_all('/search_performerid/', $next->href, $hits)) {
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
     public function processSite(string $movie): bool
167 167
     {
168 168
         $result = false;
169
-        if (! empty($movie)) {
169
+        if (!empty($movie)) {
170 170
             $this->_trailUrl = self::TRAILINGSEARCH.urlencode($movie);
171 171
             $this->_response = getRawHtml(self::ADMURL.$this->_trailUrl, $this->cookie);
172 172
             if ($this->_response !== false) {
Please login to merge, or discard this patch.
Blacklight/XXX.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 			%s %s %s %s
160 160
 			GROUP BY xxx.id
161 161
 			ORDER BY %s %s",
162
-            (! empty($xxxIDs) ? implode(',', $xxxIDs) : -1),
162
+            (!empty($xxxIDs) ? implode(',', $xxxIDs) : -1),
163 163
             $this->showPasswords,
164 164
             $this->getBrowseBy(),
165 165
             $catSrch,
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
     {
212 212
         $browseBy = ' ';
213 213
         foreach (['title', 'director', 'actors', 'genre', 'id'] as $bb) {
214
-            if (! empty($_REQUEST[$bb])) {
214
+            if (!empty($_REQUEST[$bb])) {
215 215
                 $bbv = stripslashes($_REQUEST[$bb]);
216 216
                 if ($bb === 'genre') {
217 217
                     $bbv = $this->getGenreID($bbv);
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
         string $cover = '',
247 247
         string $backdrop = ''
248 248
     ): void {
249
-        if (! empty($id)) {
249
+        if (!empty($id)) {
250 250
             XxxInfo::query()->where('id', $id)->update(
251 251
                 [
252 252
                     'title' => $title,
@@ -288,12 +288,12 @@  discard block
 block discarded – undo
288 288
     public function getGenres(bool $activeOnly = false, $gid = null): mixed
289 289
     {
290 290
         if ($activeOnly) {
291
-            return Genre::query()->where(['disabled' => 0, 'type' => Category::XXX_ROOT])->when($gid !== null, function ($query) use ($gid) {
291
+            return Genre::query()->where(['disabled' => 0, 'type' => Category::XXX_ROOT])->when($gid !== null, function($query) use ($gid) {
292 292
                 return $query->where('id', $gid);
293 293
             })->orderBy('title')->first(['title']);
294 294
         }
295 295
 
296
-        return Genre::query()->where(['type' => Category::XXX_ROOT])->when($gid !== null, function ($query) use ($gid) {
296
+        return Genre::query()->where(['type' => Category::XXX_ROOT])->when($gid !== null, function($query) use ($gid) {
297 297
             return $query->where('id', $gid);
298 298
         })->orderBy('title')->first(['title']);
299 299
     }
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
     {
309 309
         $ret = null;
310 310
 
311
-        if (! \is_array($arr)) {
311
+        if (!\is_array($arr)) {
312 312
             $res = Genre::query()->where('title', $arr)->first(['id']);
313 313
             if ($res !== null) {
314 314
                 return $res['id'];
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
     public function insertSwf($whichClass, $res): string
349 349
     {
350 350
         $ret = '';
351
-        if (($whichClass === 'ade') && ! empty($res)) {
351
+        if (($whichClass === 'ade') && !empty($res)) {
352 352
             $trailers = unserialize($res, 'ade');
353 353
             $ret .= "<object width='360' height='240' type='application/x-shockwave-flash' id='EmpireFlashPlayer' name='EmpireFlashPlayer' data='".$trailers['url']."'>";
354 354
             $ret .= "<param name='flashvars' value= 'streamID=".$trailers['streamid'].'&amp;autoPlay=false&amp;BaseStreamingUrl='.$trailers['baseurl']."'>";
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 
357 357
             return $ret;
358 358
         }
359
-        if (($whichClass === 'pop') && ! empty($res)) {
359
+        if (($whichClass === 'pop') && !empty($res)) {
360 360
             $trailers = unserialize($res, 'pop');
361 361
             $ret .= "<embed id='trailer' width='480' height='360'";
362 362
             $ret .= "flashvars='".$trailers['flashvars']."' allowfullscreen='true' allowscriptaccess='always' quality='high' name='trailer' style='undefined'";
@@ -433,22 +433,22 @@  discard block
 block discarded – undo
433 433
             return -2;
434 434
         }
435 435
 
436
-        $res['cast'] = ! empty($res['cast']) ? implode(',', $res['cast']) : '';
437
-        $res['genres'] = ! empty($res['genres']) ? $this->getGenreID($res['genres']) : '';
436
+        $res['cast'] = !empty($res['cast']) ? implode(',', $res['cast']) : '';
437
+        $res['genres'] = !empty($res['genres']) ? $this->getGenreID($res['genres']) : '';
438 438
 
439 439
         $mov = [
440
-            'trailers' => ! empty($res['trailers']) ? serialize($res['trailers']) : '',
441
-            'extras' => ! empty($res['extras']) ? serialize($res['extras']) : '',
442
-            'productinfo' => ! empty($res['productinfo']) ? serialize($res['productinfo']) : '',
443
-            'backdrop' => ! empty($res['backcover']) ? $res['backcover'] : 0,
444
-            'cover' => ! empty($res['boxcover']) ? $res['boxcover'] : 0,
445
-            'title' => ! empty($res['title']) ? html_entity_decode($res['title'], ENT_QUOTES, 'UTF-8') : '',
446
-            'plot' => ! empty($res['synopsis']) ? html_entity_decode($res['synopsis'], ENT_QUOTES, 'UTF-8') : '',
447
-            'tagline' => ! empty($res['tagline']) ? html_entity_decode($res['tagline'], ENT_QUOTES, 'UTF-8') : '',
448
-            'genre' => ! empty($res['genres']) ? html_entity_decode($res['genres'], ENT_QUOTES, 'UTF-8') : '',
449
-            'director' => ! empty($res['director']) ? html_entity_decode($res['director'], ENT_QUOTES, 'UTF-8') : '',
450
-            'actors' => ! empty($res['cast']) ? html_entity_decode($res['cast'], ENT_QUOTES, 'UTF-8') : '',
451
-            'directurl' => ! empty($res['directurl']) ? html_entity_decode($res['directurl'], ENT_QUOTES, 'UTF-8') : '',
440
+            'trailers' => !empty($res['trailers']) ? serialize($res['trailers']) : '',
441
+            'extras' => !empty($res['extras']) ? serialize($res['extras']) : '',
442
+            'productinfo' => !empty($res['productinfo']) ? serialize($res['productinfo']) : '',
443
+            'backdrop' => !empty($res['backcover']) ? $res['backcover'] : 0,
444
+            'cover' => !empty($res['boxcover']) ? $res['boxcover'] : 0,
445
+            'title' => !empty($res['title']) ? html_entity_decode($res['title'], ENT_QUOTES, 'UTF-8') : '',
446
+            'plot' => !empty($res['synopsis']) ? html_entity_decode($res['synopsis'], ENT_QUOTES, 'UTF-8') : '',
447
+            'tagline' => !empty($res['tagline']) ? html_entity_decode($res['tagline'], ENT_QUOTES, 'UTF-8') : '',
448
+            'genre' => !empty($res['genres']) ? html_entity_decode($res['genres'], ENT_QUOTES, 'UTF-8') : '',
449
+            'director' => !empty($res['director']) ? html_entity_decode($res['director'], ENT_QUOTES, 'UTF-8') : '',
450
+            'actors' => !empty($res['cast']) ? html_entity_decode($res['cast'], ENT_QUOTES, 'UTF-8') : '',
451
+            'directurl' => !empty($res['directurl']) ? html_entity_decode($res['directurl'], ENT_QUOTES, 'UTF-8') : '',
452 452
             'classused' => $this->whichClass,
453 453
         ];
454 454
 
@@ -458,12 +458,12 @@  discard block
 block discarded – undo
458 458
             $xxxID = $check['id'];
459 459
 
460 460
             // Update BoxCover.
461
-            if (! empty($mov['cover'])) {
461
+            if (!empty($mov['cover'])) {
462 462
                 $cover = $this->releaseImage->saveImage($xxxID.'-cover', $mov['cover'], $this->imgSavePath);
463 463
             }
464 464
 
465 465
             // BackCover.
466
-            if (! empty($mov['backdrop'])) {
466
+            if (!empty($mov['backdrop'])) {
467 467
                 $backdrop = $this->releaseImage->saveImage($xxxID.'-backdrop', $mov['backdrop'], $this->imgSavePath, 1920, 1024);
468 468
             }
469 469
 
@@ -491,12 +491,12 @@  discard block
 block discarded – undo
491 491
                 ]
492 492
             );
493 493
             // Update BoxCover.
494
-            if (! empty($mov['cover'])) {
494
+            if (!empty($mov['cover'])) {
495 495
                 $cover = $this->releaseImage->saveImage($xxxID.'-cover', $mov['cover'], $this->imgSavePath);
496 496
             }
497 497
 
498 498
             // BackCover.
499
-            if (! empty($mov['backdrop'])) {
499
+            if (!empty($mov['backdrop'])) {
500 500
                 $backdrop = $this->releaseImage->saveImage($xxxID.'-backdrop', $mov['backdrop'], $this->imgSavePath, 1920, 1024);
501 501
             }
502 502
 
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
             $name = trim(preg_replace('/(brazilian|chinese|croatian|danish|deutsch|dutch|estonian|flemish|finnish|french|german|greek|hebrew|icelandic|italian|latin|nordic|norwegian|polish|portuguese|japenese|japanese|russian|serbian|slovenian|spanish|spanisch|swedish|thai|turkish)$/i', '', $name));
610 610
 
611 611
             // Check if the name is long enough and not just numbers and not file (d) of (d) and does not contain Episodes and any dated 00.00.00 which are site rips..
612
-            if (\strlen($name) > 5 && ! preg_match('/^\d+$/', $name) && ! preg_match('/( File \d+ of \d+|\d+.\d+.\d+)/', $name) && ! preg_match('/(E\d+)/', $name) && ! preg_match('/\d\d\.\d\d.\d\d/', $name)) {
612
+            if (\strlen($name) > 5 && !preg_match('/^\d+$/', $name) && !preg_match('/( File \d+ of \d+|\d+.\d+.\d+)/', $name) && !preg_match('/(E\d+)/', $name) && !preg_match('/\d\d\.\d\d.\d\d/', $name)) {
613 613
                 $this->currentTitle = $name;
614 614
 
615 615
                 return true;
Please login to merge, or discard this patch.
Blacklight/NZB.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         $nzbSplitLevel = (int) Settings::settingValue('..nzbsplitlevel');
67 67
         $this->nzbSplitLevel = $nzbSplitLevel ?? 1;
68 68
         $this->siteNzbPath = (string) Settings::settingValue('..nzbpath');
69
-        if (! Str::endsWith($this->siteNzbPath, '/')) {
69
+        if (!Str::endsWith($this->siteNzbPath, '/')) {
70 70
             $this->siteNzbPath .= '/';
71 71
         }
72 72
         $this->_nzbCommentString = sprintf(
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         $XMLWriter->startElement('head');
111 111
         $XMLWriter->startElement('meta');
112 112
         $XMLWriter->writeAttribute('type', 'category');
113
-        $XMLWriter->text(! empty($release->category->parent) ? $release->category->parent->title.' >'.$release->category->title : 'Other > Misc');
113
+        $XMLWriter->text(!empty($release->category->parent) ? $release->category->parent->title.' >'.$release->category->title : 'Other > Misc');
114 114
         $XMLWriter->endElement();
115 115
         $XMLWriter->startElement('meta');
116 116
         $XMLWriter->writeAttribute('type', 'name');
@@ -172,20 +172,20 @@  discard block
 block discarded – undo
172 172
         $XMLWriter->endDocument();
173 173
         $path = ($this->buildNZBPath($release->guid, $this->nzbSplitLevel, true).$release->guid.'.nzb.gz');
174 174
         $fp = gzopen($path, 'wb7');
175
-        if (! $fp) {
175
+        if (!$fp) {
176 176
             return false;
177 177
         }
178 178
         gzwrite($fp, $XMLWriter->outputMemory());
179 179
         gzclose($fp);
180 180
         unset($XMLWriter);
181
-        if (! File::isFile($path)) {
181
+        if (!File::isFile($path)) {
182 182
             echo "ERROR: $path does not exist.\n";
183 183
 
184 184
             return false;
185 185
         }
186 186
         // Mark release as having NZB.
187 187
         $release->update(['nzbstatus' => self::NZB_ADDED]);
188
-        if (! empty($nzb_guid)) {
188
+        if (!empty($nzb_guid)) {
189 189
             $release->update(['nzb_guid' => DB::raw('UNHEX( '.escapeString(md5($nzb_guid)).' )')]);
190 190
         }
191 191
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 
217 217
         $nzbPath = $this->siteNzbPath.$nzbPath;
218 218
 
219
-        if ($createIfNotExist && ! File::isDirectory($nzbPath) && ! File::makeDirectory($nzbPath, 0777, true) && ! File::isDirectory($nzbPath)) {
219
+        if ($createIfNotExist && !File::isDirectory($nzbPath) && !File::makeDirectory($nzbPath, 0777, true) && !File::isDirectory($nzbPath)) {
220 220
             throw new \RuntimeException(sprintf('Directory "%s" was not created', $nzbPath));
221 221
         }
222 222
 
@@ -275,12 +275,12 @@  discard block
 block discarded – undo
275 275
         $i = 0;
276 276
         $result = [];
277 277
 
278
-        if (! $nzb) {
278
+        if (!$nzb) {
279 279
             return $result;
280 280
         }
281 281
 
282 282
         $xml = @simplexml_load_string(str_replace("\x0F", '', $nzb));
283
-        if (! $xml || strtolower($xml->getName()) !== 'nzb') {
283
+        if (!$xml || strtolower($xml->getName()) !== 'nzb') {
284 284
             return $result;
285 285
         }
286 286
 
@@ -294,9 +294,9 @@  discard block
 block discarded – undo
294 294
                     // Strip file / part count to get proper sorting.
295 295
                     $i = preg_replace('#\d+[- ._]?(/|\||[o0]f)[- ._]?\d+?(?![- ._]\d)#i', '', $i);
296 296
                     // Change .rar and .par2 to be sorted before .part0x.rar and .volxxx+xxx.par2
297
-                    if (str_contains($i, '.par2') && ! preg_match('#\.vol\d+\+\d+\.par2#i', $i)) {
297
+                    if (str_contains($i, '.par2') && !preg_match('#\.vol\d+\+\d+\.par2#i', $i)) {
298 298
                         $i = str_replace('.par2', '.vol0.par2', $i);
299
-                    } elseif (preg_match('#\.rar[^a-z0-9]#i', $i) && ! preg_match('#\.part\d+\.rar$#i', $i)) {
299
+                    } elseif (preg_match('#\.rar[^a-z0-9]#i', $i) && !preg_match('#\.part\d+\.rar$#i', $i)) {
300 300
                         $i = preg_replace('#\.rar(?:[^a-z0-9])#i', '.part0.rar', $i);
301 301
                     }
302 302
                 }
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
             $fileSize = $numSegments = 0;
330 330
 
331 331
             // Parts.
332
-            if (! isset($result[$i]['segments'])) {
332
+            if (!isset($result[$i]['segments'])) {
333 333
                 $result[$i]['segments'] = [];
334 334
             }
335 335
 
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
             $result[$i]['partsactual'] = $numSegments;
349 349
 
350 350
             // Groups.
351
-            if (! isset($result[$i]['groups'])) {
351
+            if (!isset($result[$i]['groups'])) {
352 352
                 $result[$i]['groups'] = [];
353 353
             }
354 354
             foreach ($file->groups->group as $g) {
Please login to merge, or discard this patch.
Blacklight/IRCClient.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
      */
151 151
     public function setSocketTimeout(int $timeout)
152 152
     {
153
-        if (! is_numeric($timeout)) {
153
+        if (!is_numeric($timeout)) {
154 154
             echo 'ERROR: IRC socket timeout must be a number!'.PHP_EOL;
155 155
         } else {
156 156
             $this->_socket_timeout = $timeout;
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
      */
165 165
     public function setConnectionTimeout(int $timeout)
166 166
     {
167
-        if (! is_numeric($timeout)) {
167
+        if (!is_numeric($timeout)) {
168 168
             echo 'ERROR: IRC connection timeout must be a number!'.PHP_EOL;
169 169
         } else {
170 170
             $this->_remote_connection_timeout = $timeout;
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
      */
177 177
     public function setConnectionRetries(int $retries)
178 178
     {
179
-        if (! is_numeric($retries)) {
179
+        if (!is_numeric($retries)) {
180 180
             echo 'ERROR: IRC connection retries must be a number!'.PHP_EOL;
181 181
         } else {
182 182
             $this->_reconnectRetries = $retries;
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
      */
191 191
     public function setReConnectDelay(int $delay)
192 192
     {
193
-        if (! is_numeric($delay)) {
193
+        if (!is_numeric($delay)) {
194 194
             echo 'ERROR: IRC reconnect delay must be a number!'.PHP_EOL;
195 195
         } else {
196 196
             $this->_reconnectDelay = $delay;
@@ -210,14 +210,14 @@  discard block
 block discarded – undo
210 210
         $transport = ($tls === true ? 'tls' : 'tcp');
211 211
 
212 212
         $socket_string = $transport.'://'.$hostname.':'.$port;
213
-        if ($socket_string !== $this->_remote_socket_string || ! $this->_connected()) {
214
-            if (! \is_string($hostname) || $hostname === '') {
213
+        if ($socket_string !== $this->_remote_socket_string || !$this->_connected()) {
214
+            if (!\is_string($hostname) || $hostname === '') {
215 215
                 echo 'ERROR: IRC host name must not be empty!'.PHP_EOL;
216 216
 
217 217
                 return false;
218 218
             }
219 219
 
220
-            if (! is_numeric($port)) {
220
+            if (!is_numeric($port)) {
221 221
                 echo 'ERROR: IRC port must be a number!'.PHP_EOL;
222 222
 
223 223
                 return false;
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
      */
262 262
     public function login(string $nickName, string $userName, string $realName, $password = null): bool
263 263
     {
264
-        if (! $this->_connected()) {
264
+        if (!$this->_connected()) {
265 265
             echo 'ERROR: You must connect to IRC first!'.PHP_EOL;
266 266
 
267 267
             return false;
@@ -278,15 +278,15 @@  discard block
 block discarded – undo
278 278
         $this->_realName = $realName;
279 279
         $this->_password = $password;
280 280
 
281
-        if (($password !== null && ! empty($password)) && ! $this->_writeSocket('PASSWORD '.$password)) {
281
+        if (($password !== null && !empty($password)) && !$this->_writeSocket('PASSWORD '.$password)) {
282 282
             return false;
283 283
         }
284 284
 
285
-        if (! $this->_writeSocket('NICK '.$nickName)) {
285
+        if (!$this->_writeSocket('NICK '.$nickName)) {
286 286
             return false;
287 287
         }
288 288
 
289
-        if (! $this->_writeSocket('USER '.$userName.' 0 * :'.$realName)) {
289
+        if (!$this->_writeSocket('USER '.$userName.' 0 * :'.$realName)) {
290 290
             return false;
291 291
         }
292 292
 
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
                         $tempPass = $password;
316 316
                     }
317 317
 
318
-                    if ($password !== null && ! $this->_writeSocket('PASS '.$tempPass)) {
318
+                    if ($password !== null && !$this->_writeSocket('PASS '.$tempPass)) {
319 319
                         return false;
320 320
                     }
321 321
 
@@ -399,13 +399,13 @@  discard block
 block discarded – undo
399 399
     {
400 400
         $this->_channels = $channels;
401 401
 
402
-        if (! $this->_connected()) {
402
+        if (!$this->_connected()) {
403 403
             echo 'ERROR: You must connect to IRC first!'.PHP_EOL;
404 404
 
405 405
             return false;
406 406
         }
407 407
 
408
-        if (! empty($channels)) {
408
+        if (!empty($channels)) {
409 409
             foreach ($channels as $channel => $password) {
410 410
                 $this->_joinChannel($channel, $password ?? '');
411 411
             }
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
         $pong = $this->_writeSocket('PING '.$host);
454 454
 
455 455
         // Check if there's a connection error.
456
-        if ($pong === false || ((time() - $this->_lastPing) > ($this->_socket_timeout / 2) && ! 0 === strpos($this->_buffer, 'PONG'))) {
456
+        if ($pong === false || ((time() - $this->_lastPing) > ($this->_socket_timeout / 2) && !0 === strpos($this->_buffer, 'PONG'))) {
457 457
             $this->_reconnect();
458 458
         }
459 459
 
@@ -468,12 +468,12 @@  discard block
 block discarded – undo
468 468
      */
469 469
     protected function _reconnect()
470 470
     {
471
-        if (! $this->connect($this->_remote_host, $this->_remote_port, $this->_remote_tls)) {
471
+        if (!$this->connect($this->_remote_host, $this->_remote_port, $this->_remote_tls)) {
472 472
             exit('FATAL: Could not reconnect to ('.$this->_remote_host.') after ('.$this->_reconnectRetries.') tries.'.PHP_EOL);
473 473
         }
474 474
 
475 475
         if ($this->_alreadyLoggedIn === false) {
476
-            if (! $this->login($this->_nickName, $this->_userName, $this->_realName, $this->_password)) {
476
+            if (!$this->login($this->_nickName, $this->_userName, $this->_realName, $this->_password)) {
477 477
                 exit('FATAL: Could not log in to ('.$this->_remote_host.')!'.PHP_EOL);
478 478
             }
479 479
 
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
         do {
491 491
             stream_set_timeout($this->_socket, $this->_socket_timeout);
492 492
             $buffer .= fgets($this->_socket, 1024);
493
-        } while (! empty($buffer) && ! preg_match('/\v+$/', $buffer));
493
+        } while (!empty($buffer) && !preg_match('/\v+$/', $buffer));
494 494
         $this->_buffer = trim($buffer);
495 495
 
496 496
         if ($this->_debug && $this->_buffer !== '') {
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
      */
577 577
     protected function _connected(): bool
578 578
     {
579
-        return \is_resource($this->_socket) && ! feof($this->_socket);
579
+        return \is_resource($this->_socket) && !feof($this->_socket);
580 580
     }
581 581
 
582 582
     /**
Please login to merge, or discard this patch.
Blacklight/IRCScraper.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
         $channels = config('irc_settings.scrape_irc_channels') ? unserialize(config('irc_settings.scrape_irc_channels'), ['allowed_classes' => ['#PreNNTmux', '#nZEDbPRE']]) : ['#PreNNTmux' => null];
174 174
         $this->joinChannels($channels);
175 175
 
176
-        if (! $this->_silent) {
176
+        if (!$this->_silent) {
177 177
             echo '['.
178 178
                 date('r').
179 179
                 '] [Scraping of IRC channels for ('.
@@ -291,34 +291,34 @@  discard block
 block discarded – undo
291 291
         } else {
292 292
             $indexData = $this->manticoreSearch->searchIndexes('predb_rt', $this->_curPre['title'], ['title']);
293 293
         }
294
-        if (! empty($indexData) || empty($this->_curPre['title'])) {
294
+        if (!empty($indexData) || empty($this->_curPre['title'])) {
295 295
             return;
296 296
         }
297 297
 
298 298
         $query = 'INSERT INTO predb (';
299 299
 
300
-        $query .= (! empty($this->_curPre['size']) ? 'size, ' : '');
301
-        $query .= (! empty($this->_curPre['category']) ? 'category, ' : '');
302
-        $query .= (! empty($this->_curPre['source']) ? 'source, ' : '');
303
-        $query .= (! empty($this->_curPre['reason']) ? 'nukereason, ' : '');
304
-        $query .= (! empty($this->_curPre['files']) ? 'files, ' : '');
305
-        $query .= (! empty($this->_curPre['reqid']) ? 'requestid, ' : '');
306
-        $query .= (! empty($this->_curPre['group_id']) ? 'groups_id, ' : '');
307
-        $query .= (! empty($this->_curPre['nuked']) ? 'nuked, ' : '');
308
-        $query .= (! empty($this->_curPre['filename']) ? 'filename, ' : '');
300
+        $query .= (!empty($this->_curPre['size']) ? 'size, ' : '');
301
+        $query .= (!empty($this->_curPre['category']) ? 'category, ' : '');
302
+        $query .= (!empty($this->_curPre['source']) ? 'source, ' : '');
303
+        $query .= (!empty($this->_curPre['reason']) ? 'nukereason, ' : '');
304
+        $query .= (!empty($this->_curPre['files']) ? 'files, ' : '');
305
+        $query .= (!empty($this->_curPre['reqid']) ? 'requestid, ' : '');
306
+        $query .= (!empty($this->_curPre['group_id']) ? 'groups_id, ' : '');
307
+        $query .= (!empty($this->_curPre['nuked']) ? 'nuked, ' : '');
308
+        $query .= (!empty($this->_curPre['filename']) ? 'filename, ' : '');
309 309
 
310 310
         $query .= 'predate, title) VALUES (';
311 311
 
312
-        $query .= (! empty($this->_curPre['size']) ? escapeString($this->_curPre['size']).', ' : '');
313
-        $query .= (! empty($this->_curPre['category']) ? escapeString($this->_curPre['category']).', ' : '');
314
-        $query .= (! empty($this->_curPre['source']) ? escapeString($this->_curPre['source']).', ' : '');
315
-        $query .= (! empty($this->_curPre['reason']) ? escapeString($this->_curPre['reason']).', ' : '');
316
-        $query .= (! empty($this->_curPre['files']) ? escapeString($this->_curPre['files']).', ' : '');
317
-        $query .= (! empty($this->_curPre['reqid']) ? $this->_curPre['reqid'].', ' : '');
318
-        $query .= (! empty($this->_curPre['group_id']) ? $this->_curPre['group_id'].', ' : '');
319
-        $query .= (! empty($this->_curPre['nuked']) ? $this->_curPre['nuked'].', ' : '');
320
-        $query .= (! empty($this->_curPre['filename']) ? escapeString($this->_curPre['filename']).', ' : '');
321
-        $query .= (! empty($this->_curPre['predate']) ? $this->_curPre['predate'].', ' : 'NOW(), ');
312
+        $query .= (!empty($this->_curPre['size']) ? escapeString($this->_curPre['size']).', ' : '');
313
+        $query .= (!empty($this->_curPre['category']) ? escapeString($this->_curPre['category']).', ' : '');
314
+        $query .= (!empty($this->_curPre['source']) ? escapeString($this->_curPre['source']).', ' : '');
315
+        $query .= (!empty($this->_curPre['reason']) ? escapeString($this->_curPre['reason']).', ' : '');
316
+        $query .= (!empty($this->_curPre['files']) ? escapeString($this->_curPre['files']).', ' : '');
317
+        $query .= (!empty($this->_curPre['reqid']) ? $this->_curPre['reqid'].', ' : '');
318
+        $query .= (!empty($this->_curPre['group_id']) ? $this->_curPre['group_id'].', ' : '');
319
+        $query .= (!empty($this->_curPre['nuked']) ? $this->_curPre['nuked'].', ' : '');
320
+        $query .= (!empty($this->_curPre['filename']) ? escapeString($this->_curPre['filename']).', ' : '');
321
+        $query .= (!empty($this->_curPre['predate']) ? $this->_curPre['predate'].', ' : 'NOW(), ');
322 322
 
323 323
         $query .= '%s)';
324 324
 
@@ -359,17 +359,17 @@  discard block
 block discarded – undo
359 359
 
360 360
         $query = 'UPDATE predb SET ';
361 361
 
362
-        $query .= (! empty($this->_curPre['size']) ? 'size = '.escapeString($this->_curPre['size']).', ' : '');
363
-        $query .= (! empty($this->_curPre['source']) ? 'source = '.escapeString($this->_curPre['source']).', ' : '');
364
-        $query .= (! empty($this->_curPre['files']) ? 'files = '.escapeString($this->_curPre['files']).', ' : '');
365
-        $query .= (! empty($this->_curPre['reason']) ? 'nukereason = '.escapeString($this->_curPre['reason']).', ' : '');
366
-        $query .= (! empty($this->_curPre['reqid']) ? 'requestid = '.$this->_curPre['reqid'].', ' : '');
367
-        $query .= (! empty($this->_curPre['group_id']) ? 'groups_id = '.$this->_curPre['group_id'].', ' : '');
368
-        $query .= (! empty($this->_curPre['predate']) ? 'predate = '.$this->_curPre['predate'].', ' : '');
369
-        $query .= (! empty($this->_curPre['nuked']) ? 'nuked = '.$this->_curPre['nuked'].', ' : '');
370
-        $query .= (! empty($this->_curPre['filename']) ? 'filename = '.escapeString($this->_curPre['filename']).', ' : '');
362
+        $query .= (!empty($this->_curPre['size']) ? 'size = '.escapeString($this->_curPre['size']).', ' : '');
363
+        $query .= (!empty($this->_curPre['source']) ? 'source = '.escapeString($this->_curPre['source']).', ' : '');
364
+        $query .= (!empty($this->_curPre['files']) ? 'files = '.escapeString($this->_curPre['files']).', ' : '');
365
+        $query .= (!empty($this->_curPre['reason']) ? 'nukereason = '.escapeString($this->_curPre['reason']).', ' : '');
366
+        $query .= (!empty($this->_curPre['reqid']) ? 'requestid = '.$this->_curPre['reqid'].', ' : '');
367
+        $query .= (!empty($this->_curPre['group_id']) ? 'groups_id = '.$this->_curPre['group_id'].', ' : '');
368
+        $query .= (!empty($this->_curPre['predate']) ? 'predate = '.$this->_curPre['predate'].', ' : '');
369
+        $query .= (!empty($this->_curPre['nuked']) ? 'nuked = '.$this->_curPre['nuked'].', ' : '');
370
+        $query .= (!empty($this->_curPre['filename']) ? 'filename = '.escapeString($this->_curPre['filename']).', ' : '');
371 371
         $query .= (
372
-            (empty($this->_oldPre['category']) && ! empty($this->_curPre['category']))
372
+            (empty($this->_oldPre['category']) && !empty($this->_curPre['category']))
373 373
                 ? 'category = '.escapeString($this->_curPre['category']).', '
374 374
                 : ''
375 375
         );
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
      */
405 405
     protected function _doEcho(bool $new = true): void
406 406
     {
407
-        if (! $this->_silent) {
407
+        if (!$this->_silent) {
408 408
             $nukeString = '';
409 409
             if ($this->_nuked !== false) {
410 410
                 switch ((int) $this->_curPre['nuked']) {
@@ -439,15 +439,15 @@  discard block
 block discarded – undo
439 439
                 $this->_curPre['title'].
440 440
                 ']'.
441 441
                 (
442
-                    ! empty($this->_curPre['category'])
442
+                    !empty($this->_curPre['category'])
443 443
                     ? ' ['.$this->_curPre['category'].']'
444 444
                     : (
445
-                        ! empty($this->_oldPre['category'])
445
+                        !empty($this->_oldPre['category'])
446 446
                         ? ' ['.$this->_oldPre['category'].']'
447 447
                         : ''
448 448
                     )
449 449
                 ).
450
-                (! empty($this->_curPre['size']) ? ' ['.$this->_curPre['size'].']' : '').
450
+                (!empty($this->_curPre['size']) ? ' ['.$this->_curPre['size'].']' : '').
451 451
                 PHP_EOL;
452 452
         }
453 453
     }
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
      */
458 458
     protected function _getGroupID(string $groupName): mixed
459 459
     {
460
-        if (! isset($this->_groupList[$groupName])) {
460
+        if (!isset($this->_groupList[$groupName])) {
461 461
             $group = UsenetGroup::query()->where('name', $groupName)->first(['id']);
462 462
             $this->_groupList[$groupName] = $group !== null ? $group['id'] : '';
463 463
         }
Please login to merge, or discard this patch.