Revert "cleanup: pt.2"

This reverts commit 33d9927abd.
This commit is contained in:
HDVinnie
2023-10-12 23:11:20 -04:00
parent 33d9927abd
commit 656647649f
67 changed files with 158 additions and 158 deletions
+1 -1
View File
@@ -46,7 +46,7 @@ class AutoHighspeedTag extends Command
{
$seedboxIps = Seedbox::all()
->pluck('ip')
->filter(fn ($ip): mixed => filter_var($ip, FILTER_VALIDATE_IP));
->filter(fn ($ip) => filter_var($ip, FILTER_VALIDATE_IP));
Torrent::withoutGlobalScope(ApprovedScope::class)
->leftJoinSub(
+1 -1
View File
@@ -39,7 +39,7 @@ class AutoRefundDownload extends Command
*
* @return mixed
*/
public function handle(): void
public function handle()
{
$now = Carbon::now();
$MIN_SEEDTIME = config('hitrun.seedtime');
+1 -1
View File
@@ -49,7 +49,7 @@ class AutoStatsClients extends Command
->groupBy('agent')
->orderBy('agent')
->get()
->mapWithKeys(fn ($item, $key): array => [$item['agent'] => $item['count']])
->mapWithKeys(fn ($item, $key) => [$item['agent'] => $item['count']])
->toArray();
if (! empty($clients)) {
+2 -2
View File
@@ -98,7 +98,7 @@ class VendorCleanup extends Command
foreach ($directories as $directory) {
foreach ($patterns as $pattern) {
$casePattern = preg_replace_callback('#([a-z])#i', fn ($matches): string => $this->prepareWord($matches), (string) $pattern);
$casePattern = preg_replace_callback('#([a-z])#i', fn ($matches) => $this->prepareWord($matches), (string) $pattern);
$files = glob($directory.'/'.$casePattern, GLOB_BRACE);
@@ -201,7 +201,7 @@ class VendorCleanup extends Command
return false;
}
protected function out(string $message): void
protected function out($message): void
{
echo $message.PHP_EOL;
}
+1 -1
View File
@@ -30,7 +30,7 @@ trait ConsoleTools
$this->io->writeln(sprintf('<fg=cyan>%s</>', $line));
}
private function white(string $line): void
private function white($line): void
{
$this->io->writeln(PHP_EOL.$line);
}
+10 -10
View File
@@ -259,28 +259,28 @@ class Bbcode
/**
* Parses the BBCode string.
*/
public function parse(array $source, $replaceLineBreaks = true): string
public function parse($source, $replaceLineBreaks = true): string
{
// Replace all void elements since they don't have closing tags
$source = str_replace('[*]', '<li>', (string) $source);
$source = preg_replace_callback(
'/\[url\](.*?)\[\/url\]/i',
fn ($matches): string => '<a href="'.htmlspecialchars($matches[1]).'">'.htmlspecialchars($matches[1]).'</a>',
fn ($matches) => '<a href="'.htmlspecialchars($matches[1]).'">'.htmlspecialchars($matches[1]).'</a>',
$source
);
$source = preg_replace_callback(
'/\[img\](.*?)\[\/img\]/i',
fn ($matches): string => '<img src="'.htmlspecialchars($matches[1]).'" loading="lazy" class="img-responsive" style="display: inline !important;">',
fn ($matches) => '<img src="'.htmlspecialchars($matches[1]).'" loading="lazy" class="img-responsive" style="display: inline !important;">',
$source
);
$source = preg_replace_callback(
'/\[img width=(\d+)\](.*?)\[\/img\]/i',
fn ($matches): string => '<img src="'.htmlspecialchars($matches[2]).'" loading="lazy" width="'.$matches[1].'px">',
fn ($matches) => '<img src="'.htmlspecialchars($matches[2]).'" loading="lazy" width="'.$matches[1].'px">',
$source
);
$source = preg_replace_callback(
'/\[img=(\d+)(?:x\d+)?\](.*?)\[\/img\]/i',
fn ($matches): string => '<img src="'.htmlspecialchars($matches[2]).'" loading="lazy" width="'.$matches[1].'px">',
fn ($matches) => '<img src="'.htmlspecialchars($matches[2]).'" loading="lazy" width="'.$matches[1].'px">',
$source
);
@@ -288,17 +288,17 @@ class Bbcode
// has to be moved into an html attribute
$source = preg_replace_callback(
'/\[youtube\](.*?)\[\/youtube\]/i',
fn ($matches): string => '<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/'.htmlspecialchars($matches[1]).'?rel=0" allow="autoplay; encrypted-media" allowfullscreen></iframe>',
fn ($matches) => '<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/'.htmlspecialchars($matches[1]).'?rel=0" allow="autoplay; encrypted-media" allowfullscreen></iframe>',
$source
);
$source = preg_replace_callback(
'/\[video\](.*?)\[\/video\]/i',
fn ($matches): string => '<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/'.htmlspecialchars($matches[1]).'?rel=0" allow="autoplay; encrypted-media" allowfullscreen></iframe>',
fn ($matches) => '<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/'.htmlspecialchars($matches[1]).'?rel=0" allow="autoplay; encrypted-media" allowfullscreen></iframe>',
$source
);
$source = preg_replace_callback(
'/\[video="youtube"\](.*?)\[\/video\]/i',
fn ($matches): string => '<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/'.htmlspecialchars($matches[1]).'?rel=0" allow="autoplay; encrypted-media" allowfullscreen></iframe>',
fn ($matches) => '<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/'.htmlspecialchars($matches[1]).'?rel=0" allow="autoplay; encrypted-media" allowfullscreen></iframe>',
$source
);
@@ -306,10 +306,10 @@ class Bbcode
// so it must be done here instead
$source = preg_replace_callback(
'/\[comparison=(.*?)\]\s*(.*?)\s*\[\/comparison\]/is',
function (array $matches): string|array|null {
function ($matches) {
$comparates = preg_split('/\s*,\s*/', $matches[1]);
$urls = preg_split('/\s*(?:,|\s)\s*/', $matches[2]);
$validatedUrls = collect($urls)->filter(fn ($url): mixed => filter_var($url, FILTER_VALIDATE_URL));
$validatedUrls = collect($urls)->filter(fn ($url) => filter_var($url, FILTER_VALIDATE_URL));
$chunkedUrls = $validatedUrls->chunk(\count($comparates));
$html = view('partials.comparison', ['comparates' => $comparates, 'urls' => $chunkedUrls])->render();
$html = preg_replace('/\s+/', ' ', $html);
+7 -7
View File
@@ -17,7 +17,7 @@ use function theodorejb\polycast\safe_int;
class Bencode
{
public static function parse_integer(array $s, &$pos)
public static function parse_integer($s, &$pos)
{
$len = \strlen((string) $s);
@@ -52,7 +52,7 @@ class Bencode
}
}
public static function parse_string(array $s, &$pos)
public static function parse_string($s, &$pos)
{
$len = \strlen((string) $s);
$lengthStr = '';
@@ -96,7 +96,7 @@ class Bencode
return $result;
}
public static function bdecode(array $s, &$pos = 0)
public static function bdecode($s, &$pos = 0)
{
$len = \strlen((string) $s);
@@ -164,7 +164,7 @@ class Bencode
}
}
public static function bencode(string $d)
public static function bencode($d)
{
if (\is_array($d)) {
$ret = 'l';
@@ -222,12 +222,12 @@ class Bencode
return self::bdecode($f);
}
public static function get_infohash(array $t): string
public static function get_infohash($t): string
{
return sha1((string) self::bencode($t['info']), true);
}
public static function get_meta(array $t): array
public static function get_meta($t): array
{
$result = [];
$size = 0;
@@ -269,7 +269,7 @@ class Bencode
return $name;
}
public static function is_v2_or_hybrid(array $t): bool
public static function is_v2_or_hybrid($t): bool
{
return isset($t['piece layers']);
}
+1 -1
View File
@@ -17,7 +17,7 @@ use App\Models\User;
class CacheUser
{
public static function user(string $id)
public static function user($id)
{
if (! $id || $id <= 0 || ! is_numeric($id)) {
return;
+9 -9
View File
@@ -18,7 +18,7 @@ if (! \function_exists('appurl')) {
}
if (! \function_exists('href_profile')) {
function href_profile($user): string
function href_profile($user)
{
$appurl = appurl();
@@ -27,7 +27,7 @@ if (! \function_exists('href_profile')) {
}
if (! \function_exists('href_article')) {
function href_article($article): string
function href_article($article)
{
$appurl = appurl();
@@ -36,7 +36,7 @@ if (! \function_exists('href_article')) {
}
if (! \function_exists('href_torrent')) {
function href_torrent($torrent): string
function href_torrent($torrent)
{
$appurl = appurl();
@@ -45,7 +45,7 @@ if (! \function_exists('href_torrent')) {
}
if (! \function_exists('href_request')) {
function href_request($torrentRequest): string
function href_request($torrentRequest)
{
$appurl = appurl();
@@ -54,7 +54,7 @@ if (! \function_exists('href_request')) {
}
if (! \function_exists('href_poll')) {
function href_poll($poll): string
function href_poll($poll)
{
$appurl = appurl();
@@ -63,7 +63,7 @@ if (! \function_exists('href_poll')) {
}
if (! \function_exists('href_playlist')) {
function href_playlist($playlist): string
function href_playlist($playlist)
{
$appurl = appurl();
@@ -72,7 +72,7 @@ if (! \function_exists('href_playlist')) {
}
if (! \function_exists('href_collection')) {
function href_collection($collection): string
function href_collection($collection)
{
$appurl = appurl();
@@ -81,7 +81,7 @@ if (! \function_exists('href_collection')) {
}
if (! \function_exists('tmdb_image')) {
function tmdb_image($type, $original): string
function tmdb_image($type, $original)
{
$new = match ($type) {
'back_big' => 'w1280',
@@ -103,7 +103,7 @@ if (! \function_exists('tmdb_image')) {
}
if (! \function_exists('modal_style')) {
function modal_style(): string
function modal_style()
{
return (auth()->user()->style == 0) ? '' : ' modal-dark';
}
+2 -2
View File
@@ -30,7 +30,7 @@ class LanguageCensor
return str_contains(self::SPECIAL_CHARS, (string) $c);
}
protected static function matchWordIndexes(array $string, $word): array
protected static function matchWordIndexes($string, $word): array
{
$result = [];
$length = \strlen((string) $word);
@@ -54,7 +54,7 @@ class LanguageCensor
/**
* Censor a text.
*/
public static function censor(array $source): string|array
public static function censor($source)
{
foreach (config('censor.redact', []) as $word) {
$result = '';
+1 -1
View File
@@ -19,7 +19,7 @@ use VStelmakh\UrlHighlight\Validator\Validator;
class Linkify
{
public function linky(string $text): string
public function linky($text): string
{
$validator = new Validator(
false, // bool - if should use top level domain to match urls without scheme
+7 -7
View File
@@ -82,7 +82,7 @@ class MediaInfo
return $output;
}
private function parseProperty($sections, string $section): array
private function parseProperty($sections, $section): array
{
$output = [];
@@ -322,7 +322,7 @@ class MediaInfo
return $pathParts['basename'];
}
private function parseFileSize(string $string): float
private function parseFileSize($string): float
{
$number = (float) str_replace(' ', '', (string) $string);
preg_match('/[KMGTPEZ]/i', (string) $string, $size);
@@ -334,22 +334,22 @@ class MediaInfo
return $number;
}
private function parseBitRate(string $string): string
private function parseBitRate($string): string
{
return str_replace([' ', 'kbps'], ['', ' kbps'], strtolower((string) $string));
}
private function parseWidthHeight(string $string): string
private function parseWidthHeight($string): string
{
return str_replace(['pixels', ' '], ' ', strtolower((string) $string));
}
private function parseAudioChannels(string $string): array|string
private function parseAudioChannels($string): array|string
{
return str_ireplace(array_keys(self::REPLACE), self::REPLACE, (string) $string);
}
private function formatOutput(array $data): array
private function formatOutput($data): array
{
$output = [];
$output['general'] = empty($data['general']) ? null : $data['general'];
@@ -360,7 +360,7 @@ class MediaInfo
return $output;
}
private function computerSize(float $number, string $size): float
private function computerSize($number, $size): float
{
$bytes = (float) $number;
$size = strtolower((string) $size);
+1 -1
View File
@@ -194,7 +194,7 @@ class StringHelper
return $years.$months.$weeks.$days.$hours.$minutes.$seconds;
}
public static function ordinal(string $number): string
public static function ordinal($number): string
{
if ((($number % 100) >= 11) && (($number % 100) <= 13)) {
return $number.'th';
+1 -1
View File
@@ -36,7 +36,7 @@ use Illuminate\Support\Carbon;
class TorrentHelper
{
public static function approveHelper(string $id): void
public static function approveHelper($id): void
{
$appurl = config('app.url');
$appname = config('app.name');
+6 -6
View File
@@ -68,7 +68,7 @@ class TorrentTools
/**
* Calculate the number of files in the torrent.
*/
public static function getFileCount(array $decodedTorrent): int
public static function getFileCount($decodedTorrent): int
{
// Multiple file torrent ?
if (\array_key_exists('files', $decodedTorrent['info']) && (is_countable($decodedTorrent['info']['files']) ? \count($decodedTorrent['info']['files']) : 0)) {
@@ -81,7 +81,7 @@ class TorrentTools
/**
* Returns the size of the torrent files.
*/
public static function getTorrentSize(array $decodedTorrent): mixed
public static function getTorrentSize($decodedTorrent): mixed
{
$size = 0;
@@ -102,7 +102,7 @@ class TorrentTools
/**
* Returns the torrent file list.
*/
public static function getTorrentFiles(array $decodedTorrent): array
public static function getTorrentFiles($decodedTorrent): array
{
$files = [];
@@ -134,7 +134,7 @@ class TorrentTools
/**
* Returns file and folder names from the torrent.
*/
public static function getFilenameArray(array $decodedTorrent): array
public static function getFilenameArray($decodedTorrent): array
{
$filenames = [];
@@ -158,7 +158,7 @@ class TorrentTools
/**
* Returns the sha1 (hash) of the torrent.
*/
public static function getTorrentHash(array $decodedTorrent): string
public static function getTorrentHash($decodedTorrent): string
{
return sha1((string) Bencode::bencode($decodedTorrent['info']));
}
@@ -166,7 +166,7 @@ class TorrentTools
/**
* Returns the number of the torrent file.
*/
public static function getTorrentFileCount(array $decodedTorrent): int
public static function getTorrentFileCount($decodedTorrent): int
{
if (\array_key_exists('files', $decodedTorrent['info'])) {
return is_countable($decodedTorrent['info']['files']) ? \count($decodedTorrent['info']['files']) : 0;
@@ -383,7 +383,7 @@ class TorrentController extends BaseController
{
$user = auth()->user();
$isRegexAllowed = $user->group->is_modo;
$isRegex = fn ($field): bool => $isRegexAllowed
$isRegex = fn ($field) => $isRegexAllowed
&& \strlen((string) $field) > 2
&& $field[0] === '/'
&& $field[-1] === '/'
+2 -2
View File
@@ -196,7 +196,7 @@ final class AnnounceController extends Controller
* @throws \App\Exceptions\TrackerException
* @throws Throwable
*/
private function checkPasskey(string $passkey): void
private function checkPasskey($passkey): void
{
// If Passkey Is Not Provided Return Error to Client
if ($passkey === null) {
@@ -331,7 +331,7 @@ final class AnnounceController extends Controller
* @throws \App\Exceptions\TrackerException
* @throws Throwable
*/
private function checkGroup(object $user): object
private function checkGroup($user): object
{
$deniedGroups = cache()->remember('denied_groups', 8 * 3600, fn () => DB::table('groups')
->selectRaw("min(case when slug = 'banned' then id end) as banned_id")
@@ -114,10 +114,10 @@ class ApplicationController extends Controller
$application->save();
// Map And Save IMG Proofs
$applicationImageProofs = collect($request->input('images'))->map(fn ($value): \App\Models\ApplicationImageProof => new ApplicationImageProof(['image' => $value]));
$applicationImageProofs = collect($request->input('images'))->map(fn ($value) => new ApplicationImageProof(['image' => $value]));
$application->imageProofs()->saveMany($applicationImageProofs);
// Map And Save URL Proofs
$applicationUrlProofs = collect($request->input('links'))->map(fn ($value): \App\Models\ApplicationUrlProof => new ApplicationUrlProof(['url' => $value]));
$applicationUrlProofs = collect($request->input('links'))->map(fn ($value) => new ApplicationUrlProof(['url' => $value]));
$application->urlProofs()->saveMany($applicationUrlProofs);
return to_route('login')
+1 -1
View File
@@ -70,7 +70,7 @@ class HomeController extends Controller
->where('last_action', '>', now()->subMinutes(5))
->orderByRaw('(select position from `groups` where `groups`.id = users.group_id), group_id, username')
->get()
->sortBy(fn ($user): bool => $user->hidden || ! $user->isVisible($user, 'other', 'show_online'))
->sortBy(fn ($user) => $user->hidden || ! $user->isVisible($user, 'other', 'show_online'))
),
'groups' => cache()->remember(
'user-groups',
@@ -53,9 +53,9 @@ class PlaylistTorrentController extends Controller
$playlistTorrents = $request->string('torrent_urls')
->explode("\n")
->map(fn ($url): string => basename($url))
->map(fn ($url) => basename($url))
->unique()
->map(fn ($id): array => ['playlist_id' => $playlist->id, 'torrent_id' => $id, 'tmdb_id' => 0])
->map(fn ($id) => ['playlist_id' => $playlist->id, 'torrent_id' => $id, 'tmdb_id' => 0])
->toArray();
Validator::make($playlistTorrents, [
+1 -1
View File
@@ -96,7 +96,7 @@ class RequestController extends Controller
return view('requests.create', [
'categories' => Category::orderBy('position')
->get()
->mapWithKeys(fn ($category): array => [$category->id => [
->mapWithKeys(fn ($category) => [$category->id => [
'name' => $category->name,
'type' => match (true) {
$category->movie_meta => 'movie',
+3 -3
View File
@@ -159,7 +159,7 @@ class TorrentController extends Controller
'categories' => Category::query()
->orderBy('position')
->get()
->mapWithKeys(fn ($cat): array => [
->mapWithKeys(fn ($cat) => [
$cat['id'] => [
'name' => $cat['name'],
'type' => match (true) {
@@ -172,7 +172,7 @@ class TorrentController extends Controller
},
]
]),
'types' => Type::orderBy('position')->get()->mapWithKeys(fn ($type): array => [$type['id'] => ['name' => $type['name']]]),
'types' => Type::orderBy('position')->get()->mapWithKeys(fn ($type) => [$type['id'] => ['name' => $type['name']]]),
'resolutions' => Resolution::orderBy('position')->get(),
'regions' => Region::orderBy('position')->get(),
'distributors' => Distributor::orderBy('name')->get(),
@@ -321,7 +321,7 @@ class TorrentController extends Controller
return view('torrent.create', [
'categories' => Category::orderBy('position')
->get()
->mapWithKeys(fn ($category): array => [$category->id => [
->mapWithKeys(fn ($category) => [$category->id => [
'name' => $category->name,
'type' => match (true) {
$category->movie_meta => 'movie',
@@ -36,7 +36,7 @@ class TorrentPeerController extends Controller
->orderByDesc('active')
->orderByDesc('seeder')
->get()
->map(function (array $peer) use ($torrent): array {
->map(function ($peer) use ($torrent) {
$progress = 100 * (1 - $peer->left / $torrent->size);
$peer['progress'] = match (true) {
0 < $progress && $progress < 1 => 1,
@@ -40,7 +40,7 @@ class EmailController extends Controller
'email',
'max:70',
'unique:users',
Rule::when(config('email-blacklist.enabled'), fn (): \App\Rules\EmailBlacklist => new EmailBlacklist()),
Rule::when(config('email-blacklist.enabled'), fn () => new EmailBlacklist()),
],
]);
@@ -97,7 +97,7 @@ class InviteController extends Controller
'unique:invites',
'unique:users',
'unique:applications',
Rule::when(config('email-blacklist.enabled'), fn (): \App\Rules\EmailBlacklist => new EmailBlacklist())
Rule::when(config('email-blacklist.enabled'), fn () => new EmailBlacklist())
],
]);
@@ -47,7 +47,7 @@ class SeedboxController extends Controller
// The user's seedbox IPs are encrypted, so they have to be decrypted first to check that the new IP inputted is unique
$userSeedboxes = Seedbox::where('user_id', '=', $user->id)->get(['ip', 'name']);
$seedboxIps = $userSeedboxes->pluck('ip')->filter(fn ($ip): mixed => filter_var($ip, FILTER_VALIDATE_IP));
$seedboxIps = $userSeedboxes->pluck('ip')->filter(fn ($ip) => filter_var($ip, FILTER_VALIDATE_IP));
$seedboxNames = $userSeedboxes->pluck('name');
$request->validate(
+1 -1
View File
@@ -53,7 +53,7 @@ class AuditLogSearch extends Component
$this->emit('paginationChanged');
}
final public function getModelNamesProperty(): array
final public function getModelNamesProperty()
{
$modelList = [];
$path = app_path()."/Models";
+4 -4
View File
@@ -35,7 +35,7 @@ class BackupPanel extends Component
final public function getBackupStatusesProperty(): array
{
return BackupDestinationStatusFactory::createForMonitorConfig(config('backup.monitor_backups'))
->map(fn (BackupDestinationStatus $backupDestinationStatus): array => [
->map(fn (BackupDestinationStatus $backupDestinationStatus) => [
'name' => $backupDestinationStatus->backupDestination()->backupName(),
'disk' => $backupDestinationStatus->backupDestination()->diskName(),
'reachable' => $backupDestinationStatus->backupDestination()->isReachable(),
@@ -78,7 +78,7 @@ class BackupPanel extends Component
return $backupDestination
->backups()
->map(function (Backup $backup): array {
->map(function (Backup $backup) {
$size = method_exists($backup, 'sizeInBytes') ? $backup->sizeInBytes() : 0;
return [
@@ -101,7 +101,7 @@ class BackupPanel extends Component
$backupDestination
->backups()
->first(fn (Backup $backup): bool => $backup->path() === $deletingFile['path'])
->first(fn (Backup $backup) => $backup->path() === $deletingFile['path'])
->delete();
$this->emit('refreshBackups');
@@ -117,7 +117,7 @@ class BackupPanel extends Component
$backupDestination = BackupDestination::create($this->activeDisk, config('backup.backup.name'));
$backup = $backupDestination->backups()->first(fn (Backup $backup): bool => $backup->path() === $filePath);
$backup = $backupDestination->backups()->first(fn (Backup $backup) => $backup->path() === $filePath);
if (! $backup) {
return response('Backup not found', ResponseAlias::HTTP_UNPROCESSABLE_ENTITY);
+1 -1
View File
@@ -30,7 +30,7 @@ class BbcodeInput extends Component
public string $contentHtml = '';
final public function mount(string $name, string $label, bool $required = false, $content = null): void
final public function mount($name, $label, $required = false, $content = null): void
{
$this->name = $name;
$this->label = $label;
+1 -1
View File
@@ -71,7 +71,7 @@ class FailedLoginSearch extends Component
->paginate($this->perPage);
}
final public function sortBy(string $field): void
final public function sortBy($field): void
{
if ($this->sortField === $field) {
$this->sortDirection = $this->sortDirection === 'asc' ? 'desc' : 'asc';
+1 -1
View File
@@ -70,7 +70,7 @@ class GiftLogSearch extends Component
]);
}
final public function sortBy(string $field): void
final public function sortBy($field): void
{
if ($this->sortField === $field) {
$this->sortDirection = $this->sortDirection === 'asc' ? 'desc' : 'asc';
+1 -1
View File
@@ -154,7 +154,7 @@ class HistorySearch extends Component
->paginate($this->perPage);
}
final public function sortBy(string $field): void
final public function sortBy($field): void
{
if ($this->sortField === $field) {
$this->sortDirection = $this->sortDirection === 'asc' ? 'desc' : 'asc';
+1 -1
View File
@@ -138,7 +138,7 @@ class InviteLogSearch extends Component
]);
}
final public function sortBy(string $field): void
final public function sortBy($field): void
{
if ($this->sortField === $field) {
$this->sortDirection = $this->sortDirection === 'asc' ? 'desc' : 'asc';
+1 -1
View File
@@ -88,7 +88,7 @@ class LaravelLogViewer extends Component
}
}
$groupedEntries = $entries->groupBy(fn ($entry): string => $entry['message'].'-'.$entry['exception'].'-'.$entry['in'].'-'.$entry['line']);
$groupedEntries = $entries->groupBy(fn ($entry) => $entry['message'].'-'.$entry['exception'].'-'.$entry['in'].'-'.$entry['line']);
$currentEntries = $groupedEntries->forPage($this->page, $this->perPage);
return new LengthAwarePaginator($currentEntries, $groupedEntries->count(), $this->perPage, $this->page);
+1 -1
View File
@@ -40,7 +40,7 @@ class MissingMediaSearch extends Component
return Type::select('id', 'position', 'name')->orderBy('position')->get();
}
final public function sortBy(string $field): void
final public function sortBy($field): void
{
if ($this->sortField === $field) {
$this->sortDirection = $this->sortDirection === 'asc' ? 'desc' : 'asc';
+1 -1
View File
@@ -138,7 +138,7 @@ class NotificationSearch extends Component
->paginate($this->perPage);
}
final public function sortBy(string $field): void
final public function sortBy($field): void
{
if ($this->sortField === $field) {
$this->sortDirection = $this->sortDirection === 'asc' ? 'desc' : 'asc';
+1 -1
View File
@@ -31,7 +31,7 @@ class PasswordStrength extends Component
4 => 'Strong',
];
final public function updatedPassword(string $password): void
final public function updatedPassword($password): void
{
$this->strengthScore = (new Zxcvbn())->passwordStrength($password)['score'];
}
+1 -1
View File
@@ -211,7 +211,7 @@ class PeerSearch extends Component
->paginate($this->perPage);
}
final public function sortBy(string $field): void
final public function sortBy($field): void
{
if ($this->sortField === $field) {
$this->sortDirection = $this->sortDirection === 'asc' ? 'desc' : 'asc';
+5 -5
View File
@@ -221,7 +221,7 @@ class PersonCredit extends Component
function ($tv) {
$category_id = $tv->first()->category_id;
$tv = $tv
->groupBy(fn ($torrent): string => $torrent->season_number === 0 ? ($torrent->episode_number === 0 ? 'Complete Pack' : 'Specials') : 'Seasons')
->groupBy(fn ($torrent) => $torrent->season_number === 0 ? ($torrent->episode_number === 0 ? 'Complete Pack' : 'Specials') : 'Seasons')
->map(fn ($packOrSpecialOrSeasons, $key) => match ($key) {
'Complete Pack' => $packOrSpecialOrSeasons
->sortBy('type.position')
@@ -237,7 +237,7 @@ class PersonCredit extends Component
->values()
),
'Specials' => $packOrSpecialOrSeasons
->groupBy(fn ($torrent): string => 'Special '.$torrent->episode_number)
->groupBy(fn ($torrent) => 'Special '.$torrent->episode_number)
->map(
fn ($episode) => $episode
->sortBy('type.position')
@@ -254,11 +254,11 @@ class PersonCredit extends Component
)
),
'Seasons' => $packOrSpecialOrSeasons
->groupBy(fn ($torrent): string => 'Season '.$torrent->season_number)
->groupBy(fn ($torrent) => 'Season '.$torrent->season_number)
->sortKeys(SORT_NATURAL)
->map(
fn ($season) => $season
->groupBy(fn ($torrent): string => $torrent->episode_number === 0 ? 'Season Pack' : 'Episodes')
->groupBy(fn ($torrent) => $torrent->episode_number === 0 ? 'Season Pack' : 'Episodes')
->map(fn ($packOrEpisodes, $key) => match ($key) {
'Season Pack' => $packOrEpisodes
->sortBy('type.position')
@@ -274,7 +274,7 @@ class PersonCredit extends Component
->values()
),
'Episodes' => $packOrEpisodes
->groupBy(fn ($torrent): string => 'Episode '.$torrent->episode_number)
->groupBy(fn ($torrent) => 'Episode '.$torrent->episode_number)
->sortKeys(SORT_NATURAL)
->map(
fn ($episode) => $episode
+3 -3
View File
@@ -49,13 +49,13 @@ class SimilarTorrent extends Component
final public function updatedSelectPage($value): void
{
$this->checked = $value ? $this->torrents->pluck('id')->map(fn ($item): string => (string) $item)->toArray() : [];
$this->checked = $value ? $this->torrents->pluck('id')->map(fn ($item) => (string) $item)->toArray() : [];
}
final public function selectAll(): void
{
$this->selectAll = true;
$this->checked = $this->torrents->pluck('id')->map(fn ($item): string => (string) $item)->toArray();
$this->checked = $this->torrents->pluck('id')->map(fn ($item) => (string) $item)->toArray();
}
final public function updatedChecked(): void
@@ -112,7 +112,7 @@ class SimilarTorrent extends Component
->get();
}
final public function sortBy(string $field): void
final public function sortBy($field): void
{
if ($this->sortField === $field) {
$this->sortDirection = $this->sortDirection === 'asc' ? 'desc' : 'asc';
+1 -1
View File
@@ -70,7 +70,7 @@ class SubtitleSearch extends Component
->paginate($this->perPage);
}
final public function sortBy(string $field): void
final public function sortBy($field): void
{
if ($this->sortField === $field) {
$this->sortDirection = $this->sortDirection === 'asc' ? 'desc' : 'asc';
+1 -1
View File
@@ -77,7 +77,7 @@ class TicketSearch extends Component
->paginate($this->perPage);
}
final public function sortBy(string $field): void
final public function sortBy($field): void
{
if ($this->sortField === $field) {
$this->sortDirection = $this->sortDirection === 'asc' ? 'desc' : 'asc';
+2 -2
View File
@@ -124,7 +124,7 @@ class TorrentRequestSearch extends Component
{
$user = auth()->user();
$isRegexAllowed = $user->group->is_modo;
$isRegex = fn ($field): bool => $isRegexAllowed
$isRegex = fn ($field) => $isRegexAllowed
&& \strlen((string) $field) > 2
&& $field[0] === '/'
&& $field[-1] === '/'
@@ -183,7 +183,7 @@ class TorrentRequestSearch extends Component
->paginate($this->perPage);
}
final public function sortBy(string $field): void
final public function sortBy($field): void
{
if ($this->sortField === $field) {
$this->sortDirection = $this->sortDirection === 'asc' ? 'desc' : 'asc';
+7 -7
View File
@@ -196,7 +196,7 @@ class TorrentSearch extends Component
{
$user = auth()->user();
$isRegexAllowed = $user->group->is_modo;
$isRegex = fn ($field): bool => $isRegexAllowed
$isRegex = fn ($field) => $isRegexAllowed
&& \strlen((string) $field) > 2
&& $field[0] === '/'
&& $field[-1] === '/'
@@ -458,7 +458,7 @@ class TorrentSearch extends Component
function ($tv) {
$category_id = $tv->first()->category_id;
$tv = $tv
->groupBy(fn ($torrent): string => $torrent->season_number === 0 ? ($torrent->episode_number === 0 ? 'Complete Pack' : 'Specials') : 'Seasons')
->groupBy(fn ($torrent) => $torrent->season_number === 0 ? ($torrent->episode_number === 0 ? 'Complete Pack' : 'Specials') : 'Seasons')
->map(fn ($packOrSpecialOrSeasons, $key) => match ($key) {
'Complete Pack' => $packOrSpecialOrSeasons
->sortBy('type.position')
@@ -474,7 +474,7 @@ class TorrentSearch extends Component
->values()
),
'Specials' => $packOrSpecialOrSeasons
->groupBy(fn ($torrent): string => 'Special '.$torrent->episode_number)
->groupBy(fn ($torrent) => 'Special '.$torrent->episode_number)
->map(
fn ($episode) => $episode
->sortBy('type.position')
@@ -491,11 +491,11 @@ class TorrentSearch extends Component
)
),
'Seasons' => $packOrSpecialOrSeasons
->groupBy(fn ($torrent): string => 'Season '.$torrent->season_number)
->groupBy(fn ($torrent) => 'Season '.$torrent->season_number)
->sortKeys(SORT_NATURAL)
->map(
fn ($season) => $season
->groupBy(fn ($torrent): string => $torrent->episode_number === 0 ? 'Season Pack' : 'Episodes')
->groupBy(fn ($torrent) => $torrent->episode_number === 0 ? 'Season Pack' : 'Episodes')
->map(fn ($packOrEpisodes, $key) => match ($key) {
'Season Pack' => $packOrEpisodes
->sortBy('type.position')
@@ -511,7 +511,7 @@ class TorrentSearch extends Component
->values()
),
'Episodes' => $packOrEpisodes
->groupBy(fn ($torrent): string => 'Episode '.$torrent->episode_number)
->groupBy(fn ($torrent) => 'Episode '.$torrent->episode_number)
->sortKeys(SORT_NATURAL)
->map(
fn ($episode) => $episode
@@ -616,7 +616,7 @@ class TorrentSearch extends Component
return $groups;
}
final public function sortBy(string $field): void
final public function sortBy($field): void
{
if ($this->sortField === $field) {
$this->sortDirection = $this->sortDirection === 'asc' ? 'desc' : 'asc';
+1 -1
View File
@@ -124,7 +124,7 @@ class UserActive extends Component
]);
}
final public function sortBy(string $field): void
final public function sortBy($field): void
{
if ($this->sortField === $field) {
$this->sortDirection = $this->sortDirection === 'asc' ? 'desc' : 'asc';
+1 -1
View File
@@ -88,7 +88,7 @@ class UserResurrections extends Component
]);
}
final public function sortBy(string $field): void
final public function sortBy($field): void
{
if ($this->sortField === $field) {
$this->sortDirection = $this->sortDirection === 'asc' ? 'desc' : 'asc';
+1 -1
View File
@@ -78,7 +78,7 @@ class UserSearch extends Component
->paginate($this->perPage);
}
final public function sortBy(string $field): void
final public function sortBy($field): void
{
if ($this->sortField === $field) {
$this->sortDirection = $this->sortDirection === 'asc' ? 'desc' : 'asc';
+1 -1
View File
@@ -170,7 +170,7 @@ class UserTorrents extends Component
]);
}
final public function sortBy(string $field): void
final public function sortBy($field): void
{
if ($this->sortField === $field) {
$this->sortDirection = $this->sortDirection === 'asc' ? 'desc' : 'asc';
+1 -1
View File
@@ -90,7 +90,7 @@ class UserUploads extends Component
]);
}
final public function sortBy(string $field): void
final public function sortBy($field): void
{
if ($this->sortField === $field) {
$this->sortDirection = $this->sortDirection === 'asc' ? 'desc' : 'asc';
+1 -1
View File
@@ -74,7 +74,7 @@ class WarningLogSearch extends Component
->paginate($this->perPage);
}
final public function sortBy(string $field): void
final public function sortBy($field): void
{
if ($this->sortField === $field) {
$this->sortDirection = $this->sortDirection === 'asc' ? 'desc' : 'asc';
+1 -1
View File
@@ -55,7 +55,7 @@ class WatchlistSearch extends Component
->paginate($this->perPage);
}
final public function sortBy(string $field): void
final public function sortBy($field): void
{
if ($this->sortField === $field) {
$this->sortDirection = $this->sortDirection === 'asc' ? 'desc' : 'asc';
@@ -36,7 +36,7 @@ class ApproveApplicationRequest extends FormRequest
'max:70',
'unique:invites',
'unique:users',
Rule::when(config('email-blacklist.enabled'), fn (): \App\Rules\EmailBlacklist => new EmailBlacklist()),
Rule::when(config('email-blacklist.enabled'), fn () => new EmailBlacklist()),
],
'approve' => 'required',
];
+1 -1
View File
@@ -24,7 +24,7 @@ class BotResource extends JsonResource
/**
* Transform the resource into an array.
*/
public function toArray(\Illuminate\Http\Request $request): array|\Illuminate\Contracts\Support\Arrayable|JsonSerializable
public function toArray($request): array|\Illuminate\Contracts\Support\Arrayable|JsonSerializable
{
return parent::toArray($request);
}
+1 -1
View File
@@ -21,7 +21,7 @@ class UserResource extends JsonResource
/**
* Transform the resource into an array.
*/
public function toArray(\Illuminate\Http\Request $request): array|\Illuminate\Contracts\Support\Arrayable|JsonSerializable
public function toArray($request): array|\Illuminate\Contracts\Support\Arrayable|JsonSerializable
{
return parent::toArray($request);
}
+2 -2
View File
@@ -62,11 +62,11 @@ class AppServiceProvider extends ServiceProvider
});
// Hidden Captcha
Blade::directive('hiddencaptcha', fn ($mustBeEmptyField = '_username'): string => sprintf('<?= App\Helpers\HiddenCaptcha::render(%s); ?>', $mustBeEmptyField));
Blade::directive('hiddencaptcha', fn ($mustBeEmptyField = '_username') => sprintf('<?= App\Helpers\HiddenCaptcha::render(%s); ?>', $mustBeEmptyField));
$this->app['validator']->extendImplicit(
'hiddencaptcha',
function ($attribute, $value, array $parameters, $validator): bool {
function ($attribute, $value, $parameters, $validator) {
$minLimit = (isset($parameters[0]) && is_numeric($parameters[0])) ? $parameters[0] : 0;
$maxLimit = (isset($parameters[1]) && is_numeric($parameters[1])) ? $parameters[1] : 1_200;
+3 -3
View File
@@ -21,7 +21,7 @@ class Collection
public $data;
public function __construct(string $id)
public function __construct($id)
{
$this->client = new \GuzzleHttp\Client(
[
@@ -50,12 +50,12 @@ class Collection
return $this->data;
}
public function get_name(): ?string
public function get_name()
{
return preg_replace('/[[:^print:]]/', '', (string) $this->data['name']);
}
public function get_overview(): ?string
public function get_overview()
{
return preg_replace('/[[:^print:]]/', '', (string) $this->data['overview']);
}
+4 -4
View File
@@ -23,7 +23,7 @@ class Company
public $data;
public function __construct(string $id, $page = null)
public function __construct($id, $page = null)
{
$this->client = new \GuzzleHttp\Client(
[
@@ -58,12 +58,12 @@ class Company
return $this->data['birthday'];
}
public function get_known_for_department(): ?string
public function get_known_for_department()
{
return preg_replace('/[[:^print:]]/', '', (string) $this->data['known_for_department']);
}
public function get_deathday(): ?string
public function get_deathday()
{
return preg_replace('/[[:^print:]]/', '', (string) $this->data['deathday']);
}
@@ -78,7 +78,7 @@ class Company
return 'https://image.tmdb.org/t/p/original'.$this->data['profile_path'];
}
public function get_name(): ?string
public function get_name()
{
return preg_replace('/[[:^print:]]/', '', (string) $this->data['name']);
}
+3 -3
View File
@@ -21,7 +21,7 @@ class Episode
public $data;
public function __construct(string $id, string $season, string $episode)
public function __construct($id, $season, $episode)
{
$this->client = new \GuzzleHttp\Client(
[
@@ -55,12 +55,12 @@ class Episode
return $this->data['first_air_date'];
}
public function get_name(): ?string
public function get_name()
{
return preg_replace('/[[:^print:]]/', '', (string) $this->data['name']);
}
public function get_overview(): ?string
public function get_overview()
{
return preg_replace('/[[:^print:]]/', '', (string) $this->data['overview']);
}
+1 -1
View File
@@ -21,7 +21,7 @@ class FindMovie
public $data;
public function __construct(string $query, string $year)
public function __construct($query, $year)
{
$this->client = new \GuzzleHttp\Client(
[
+1 -1
View File
@@ -21,7 +21,7 @@ class FindTv
public $data;
public function __construct(string $query, string $year)
public function __construct($query, $year)
{
$this->client = new \GuzzleHttp\Client(
[
+4 -4
View File
@@ -21,7 +21,7 @@ class Genre
public $data;
public function __construct(string $id)
public function __construct($id)
{
$this->client = new \GuzzleHttp\Client(
[
@@ -54,12 +54,12 @@ class Genre
return $this->data['birthday'];
}
public function get_known_for_department(): ?string
public function get_known_for_department()
{
return preg_replace('/[[:^print:]]/', '', (string) $this->data['known_for_department']);
}
public function get_deathday(): ?string
public function get_deathday()
{
return preg_replace('/[[:^print:]]/', '', (string) $this->data['deathday']);
}
@@ -74,7 +74,7 @@ class Genre
return 'https://image.tmdb.org/t/p/original'.$this->data['profile_path'];
}
public function get_name(): ?string
public function get_name()
{
return preg_replace('/[[:^print:]]/', '', (string) $this->data['name']);
}
+8 -8
View File
@@ -21,7 +21,7 @@ class Movie
public $data;
public function __construct(string $id)
public function __construct($id)
{
$this->client = new \GuzzleHttp\Client(
[
@@ -69,7 +69,7 @@ class Movie
return $this->data['belongs_to_collection'];
}
public function get_budget(): ?string
public function get_budget()
{
return preg_replace('/[[:^print:]]/', '', (string) $this->data['budget']);
}
@@ -79,7 +79,7 @@ class Movie
return $this->data['genres'];
}
public function get_homepage(): ?string
public function get_homepage()
{
return preg_replace('/[[:^print:]]/', '', (string) $this->data['homepage']);
}
@@ -89,12 +89,12 @@ class Movie
return $this->data['id'];
}
public function get_imdb_id(): ?string
public function get_imdb_id()
{
return preg_replace('/[[:^print:]]/', '', (string) $this->data['imdb_id']);
}
public function get_original_title(): ?string
public function get_original_title()
{
return preg_replace('/[[:^print:]]/', '', (string) $this->data['original_title']);
}
@@ -104,7 +104,7 @@ class Movie
return $this->data['alternative_titles'];
}
public function get_overview(): ?string
public function get_overview()
{
return preg_replace('/[[:^print:]]/', '', (string) $this->data['overview']);
}
@@ -153,12 +153,12 @@ class Movie
return $this->data['status'];
}
public function get_tagline(): ?string
public function get_tagline()
{
return preg_replace('/[[:^print:]]/', '', (string) $this->data['tagline']);
}
public function get_title(): ?string
public function get_title()
{
return preg_replace('/[[:^print:]]/', '', (string) $this->data['title']);
}
+4 -4
View File
@@ -21,7 +21,7 @@ class Network
public $data;
public function __construct(string $id)
public function __construct($id)
{
$this->client = new \GuzzleHttp\Client(
[
@@ -55,12 +55,12 @@ class Network
return $this->data['birthday'];
}
public function get_known_for_department(): ?string
public function get_known_for_department()
{
return preg_replace('/[[:^print:]]/', '', (string) $this->data['known_for_department']);
}
public function get_deathday(): ?string
public function get_deathday()
{
return preg_replace('/[[:^print:]]/', '', (string) $this->data['deathday']);
}
@@ -75,7 +75,7 @@ class Network
return 'https://image.tmdb.org/t/p/original'.$this->data['profile_path'];
}
public function get_name(): ?string
public function get_name()
{
return preg_replace('/[[:^print:]]/', '', (string) $this->data['name']);
}
+4 -4
View File
@@ -21,7 +21,7 @@ class Person
public $data;
public function __construct(string $id)
public function __construct($id)
{
$this->client = new \GuzzleHttp\Client(
[
@@ -55,12 +55,12 @@ class Person
return $this->data['birthday'];
}
public function get_known_for_department(): ?string
public function get_known_for_department()
{
return preg_replace('/[[:^print:]]/', '', (string) $this->data['known_for_department']);
}
public function get_deathday(): ?string
public function get_deathday()
{
return preg_replace('/[[:^print:]]/', '', (string) $this->data['deathday']);
}
@@ -75,7 +75,7 @@ class Person
return 'https://image.tmdb.org/t/p/original'.$this->data['profile_path'];
}
public function get_name(): ?string
public function get_name()
{
return preg_replace('/[[:^print:]]/', '', (string) $this->data['name']);
}
+3 -3
View File
@@ -21,7 +21,7 @@ class Season
public $data;
public function __construct(string $id, string $season)
public function __construct($id, $season)
{
$this->client = new \GuzzleHttp\Client(
[
@@ -60,12 +60,12 @@ class Season
return $this->data['air_date'];
}
public function get_name(): ?string
public function get_name()
{
return preg_replace('/[[:^print:]]/', '', (string) $this->data['name']);
}
public function get_overview(): ?string
public function get_overview()
{
return preg_replace('/[[:^print:]]/', '', (string) $this->data['overview']);
}
+5 -5
View File
@@ -21,7 +21,7 @@ class TV
public $data;
public function __construct(string $id)
public function __construct($id)
{
$this->client = new \GuzzleHttp\Client(
[
@@ -89,7 +89,7 @@ class TV
return $this->data['id'];
}
public function get_imdb_id(): ?string
public function get_imdb_id()
{
return preg_replace('/[[:^print:]]/', '', (string) $this->data['imdb_id']);
}
@@ -109,7 +109,7 @@ class TV
return $this->data['last_episode_to_air'];
}
public function get_name(): ?string
public function get_name()
{
return preg_replace('/[[:^print:]]/', '', (string) $this->data['name']);
}
@@ -144,12 +144,12 @@ class TV
return $this->data['original_language'];
}
public function get_original_name(): ?string
public function get_original_name()
{
return preg_replace('/[[:^print:]]/', '', (string) $this->data['original_name']);
}
public function get_overview(): ?string
public function get_overview()
{
return preg_replace('/[[:^print:]]/', '', (string) $this->data['overview']);
}
+5 -5
View File
@@ -15,7 +15,7 @@ namespace App\Services\Tmdb;
class TMDB
{
public function image(string $type, array $array): ?string
public function image($type, $array): ?string
{
if (isset($array[$type.'_path'])) {
return 'https://image.tmdb.org/t/p/original'.$array[$type.'_path'];
@@ -24,7 +24,7 @@ class TMDB
return null;
}
public function trailer(array $array): ?string
public function trailer($array): ?string
{
if (isset($array['videos']['results'])) {
return 'https://www.youtube.com/embed/'.$array['videos']['results'][0]['key'];
@@ -33,12 +33,12 @@ class TMDB
return null;
}
public function ifHasItems($type, array $array)
public function ifHasItems($type, $array)
{
return $array[$type][0] ?? null;
}
public function ifExists($type, array $array)
public function ifExists($type, $array)
{
if (isset($array[$type]) && ! empty($array[$type])) {
return $array[$type];
@@ -47,7 +47,7 @@ class TMDB
return;
}
public function cast_array(array $cast): array
public function cast_array($cast): array
{
return [
'character' => $cast['character'],