Replace usage of str_ helper with Str class directly to prepare for Laravel 5.8 changes

This commit is contained in:
DariusIII
2019-01-29 13:33:35 +01:00
parent 980e434d73
commit 4b4de3acef
8 changed files with 36 additions and 28 deletions
+3 -2
View File
@@ -10,6 +10,7 @@ use App\Models\BinaryBlacklist;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Database\QueryException;
use Illuminate\Support\Str;
/**
* Class Binaries.
@@ -278,7 +279,7 @@ class Binaries
}
$this->log(
'Updating completed in '.str_plural(' second', now()->diffInSeconds($allTime)),
'Updating completed in '.Str::plural(' second', now()->diffInSeconds($allTime)),
__FUNCTION__,
'primary'
);
@@ -513,7 +514,7 @@ class Binaries
if ($this->_echoCLI) {
$this->colorCli->primary(
PHP_EOL.'Group '.$groupMySQL['name'].' processed in '.
str_plural(' second', now()->diffInSeconds($startGroup))
Str::plural(' second', now()->diffInSeconds($startGroup))
);
}
} elseif ($this->_echoCLI) {
+4 -3
View File
@@ -4,6 +4,7 @@ namespace Blacklight\libraries;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
use Illuminate\Support\Str;
/**
* Class TraktAPI
@@ -189,7 +190,7 @@ class TraktAPI
default:
$extended = 'min';
}
$array = $this->getJsonArray(self::API_URL.'movies/'.str_slug($movie), $extended);
$array = $this->getJsonArray(self::API_URL.'movies/'.Str::slug($movie), $extended);
if (! $array) {
return false;
}
@@ -247,7 +248,7 @@ class TraktAPI
public function showSearch($show = '', $type = 'show')
{
$searchUrl = self::API_URL.'search?query='.
str_slug($show).
Str::slug($show).
'&type='.$type;
return $this->getJsonArray($searchUrl, '');
@@ -269,7 +270,7 @@ class TraktAPI
if (empty($show)) {
return null;
}
$showUrl = self::API_URL.'shows/'.str_slug($show);
$showUrl = self::API_URL.'shows/'.Str::slug($show);
if ($type === 'full') {
$extended = 'full';
+16 -15
View File
@@ -19,6 +19,7 @@ use Blacklight\ReleaseImage;
use App\Models\ReleasesGroups;
use Blacklight\ReleaseCleaning;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
class ProcessReleases
{
@@ -314,7 +315,7 @@ class ProcessReleases
$this->colorCli->primary(
($count === null ? 0 : $count->complete).' collections were found to be complete. Time: '.
$totalTime.str_plural(' second', $totalTime),
$totalTime.Str::plural(' second', $totalTime),
true
);
}
@@ -357,7 +358,7 @@ class ProcessReleases
true
);
$totalTime = now()->diffInSeconds($startTime);
$this->colorCli->primary($totalTime.str_plural(' second', $totalTime), true);
$this->colorCli->primary($totalTime.Str::plural(' second', $totalTime), true);
}
}
@@ -483,7 +484,7 @@ class ProcessReleases
$minSizeDeleted.' smaller than, '.
$maxSizeDeleted.' bigger than, '.
$minFilesDeleted.' with less files than site/group settings in: '.
$totalTime.str_plural(' second', $totalTime),
$totalTime.Str::plural(' second', $totalTime),
true
);
}
@@ -685,7 +686,7 @@ class ProcessReleases
' Releases added and '.
number_format($duplicate).
' duplicate collections deleted in '.
$totalTime.str_plural(' second', $totalTime),
$totalTime.Str::plural(' second', $totalTime),
true
);
}
@@ -744,8 +745,8 @@ class ProcessReleases
if ($this->echoCLI) {
$this->colorCli->primary(
number_format($nzbCount).' NZBs created/Collections deleted in '.
$totalTime.str_plural(' second', $totalTime).PHP_EOL.
'Total time: '.$totalTime.str_plural(' second', $totalTime),
$totalTime.Str::plural(' second', $totalTime).PHP_EOL.
'Total time: '.$totalTime.Str::plural(' second', $totalTime),
true
);
}
@@ -788,7 +789,7 @@ class ProcessReleases
$totalTime = now()->diffInSeconds($startTime);
if ($this->echoCLI) {
$this->colorCli->primary($totalTime.str_plural(' second', $totalTime));
$this->colorCli->primary($totalTime.Str::plural(' second', $totalTime));
}
}
@@ -860,7 +861,7 @@ class ProcessReleases
if ($this->echoCLI) {
$this->colorCli->primary(
'Finished deleting '.$deleted.' old collections/binaries/parts in '.
$totalTime.str_plural(' second', $totalTime),
$totalTime.Str::plural(' second', $totalTime),
true
);
}
@@ -898,7 +899,7 @@ class ProcessReleases
if ($this->echoCLI) {
$this->colorCli->primary(
'Finished deleting '.$deleted.' orphaned collections in '.
$totalTime.str_plural(' second', $totalTime),
$totalTime.Str::plural(' second', $totalTime),
true
);
}
@@ -934,7 +935,7 @@ class ProcessReleases
if ($this->echoCLI) {
$this->colorCli->primary(
'Finished deleting '.$deleted.' binaries with no collections or parts in '.$totalTime.str_plural(' second', $totalTime),
'Finished deleting '.$deleted.' binaries with no collections or parts in '.$totalTime.Str::plural(' second', $totalTime),
true
);
}
@@ -971,7 +972,7 @@ class ProcessReleases
if ($this->echoCLI) {
$this->colorCli->primary(
'Finished deleting '.$deleted.' parts with no binaries in '.
$totalTime.str_plural(' second', $totalTime),
$totalTime.Str::plural(' second', $totalTime),
true
);
}
@@ -1016,11 +1017,11 @@ class ProcessReleases
if ($this->echoCLI) {
$this->colorCli->primary(
'Finished deleting '.$deleted.' collections missed after NZB creation in '.
$colDelTime.str_plural(' second', $colDelTime).PHP_EOL.
$colDelTime.Str::plural(' second', $colDelTime).PHP_EOL.
'Removed '.
number_format($deletedCount).
' parts/binaries/collection rows in '.
$totalTime.str_plural(' second', $totalTime),
$totalTime.Str::plural(' second', $totalTime),
true
);
}
@@ -1117,7 +1118,7 @@ class ProcessReleases
' releases: '.PHP_EOL.
$minSizeDeleted.' smaller than, '.$maxSizeDeleted.' bigger than, '.$minFilesDeleted.
' with less files than site/groups setting in: '.
$totalTime.str_plural(' second', $totalTime),
$totalTime.Str::plural(' second', $totalTime),
true
);
}
@@ -1352,7 +1353,7 @@ class ProcessReleases
$totalTime = now()->diffInSeconds($startTime);
$this->colorCli->primary(
'Removed '.number_format($totalDeleted).' releases in '.
$totalTime.str_plural(' second', $totalTime),
$totalTime.Str::plural(' second', $totalTime),
true
);
}
+2 -1
View File
@@ -19,6 +19,7 @@
* @copyright 2014 nZEDb
*/
use App\Models\Category;
use Illuminate\Support\Str;
/**
* Returns the value of the specified Category constant.
@@ -155,7 +156,7 @@ function release_flag($text, $page)
}
if ($code !== '' && $page === 'browse') {
$www = str_finish(WWW_TOP, '/');
$www = Str::finish(WWW_TOP, '/');
return
'<img title="'.$language.'" alt="'.$language.'" src="'.$www.'assets/images/flags/'.$code.'.png"/>';
+4 -3
View File
@@ -6,6 +6,7 @@ use App\Models\Settings;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\File;
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
use Illuminate\Support\Str;
/**
* Class Utility.
@@ -251,10 +252,10 @@ class Utility
if (! \defined('NN_COVERS')) {
switch (true) {
case $path[0] === '/' || $path[1] === ':' || $path[0] === '\\':
\define('NN_COVERS', str_finish($path, '/'));
\define('NN_COVERS', Str::finish($path, '/'));
break;
case \strlen($path) > 0 && $path[0] !== '/' && $path[1] !== ':' && $path[0] !== '\\':
\define('NN_COVERS', realpath(NN_ROOT.str_finish($path, '/')));
case $path !== '' && $path[0] !== '/' && $path[1] !== ':' && $path[0] !== '\\':
\define('NN_COVERS', realpath(NN_ROOT.Str::finish($path, '/')));
break;
case empty($path): // Default to resources location.
default:
+1
View File
@@ -1,4 +1,5 @@
2019-01-29 DariusIII
* Chg: Replace usage of str_ helper with Str class directly to prepare for Laravel 5.8 changes
* Chg: Update vlucas/phpdotenv to version 2.6.1
* Chg: Update used libraries to their latest versions
* Chg: Update BTC support to take into account current role expiration date
+4 -3
View File
@@ -6,6 +6,7 @@ use App\Models\User;
use App\Models\Settings;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Str;
use Symfony\Component\Process\Process;
class InstallNntmux extends Command
@@ -146,9 +147,9 @@ class InstallNntmux extends Command
}
return [
'nzb_path' => str_finish($nzb_path, '/'),
'covers_path' => str_finish($covers_path, '/'),
'unrar_path' => str_finish($unrar_path, '/'),
'nzb_path' => Str::finish($nzb_path, '/'),
'covers_path' => Str::finish($covers_path, '/'),
'unrar_path' => Str::finish($unrar_path, '/'),
];
}
+2 -1
View File
@@ -14,6 +14,7 @@ use App\Models\ReleaseComment;
use Blacklight\utility\Utility;
use App\Jobs\SendAccountDeletedEmail;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Str;
use Jrean\UserVerification\Facades\UserVerification;
class ProfileController extends BasePageController
@@ -186,7 +187,7 @@ class ProfileController extends BasePageController
$request->input('nzbgeturl') ?? '',
$request->input('nzbgetusername') ?? '',
$request->input('nzbgetpassword') ?? '',
$request->has('saburl') ? str_finish($request->input('saburl'), '/') : '',
$request->has('saburl') ? Str::finish($request->input('saburl'), '/') : '',
$request->input('sabapikey') ?? '',
$request->input('sabpriority') ?? '',
$request->input('sabapikeytype') ?? '',