Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php namespace App\Console\Commands; use App\Models\Song; use Illuminate\Console\Comman..
Decoded Output download
<?php
namespace App\Console\Commands;
use App\Models\Song;
use Illuminate\Console\Command;
class CollectTagsCommand extends Command
{
protected $signature = 'koel:tags:collect {tag*}';
protected $description = 'Collect additional tags from existing songs';
private const ALL_TAGS = [
'title',
'album',
'artist',
'albumartist',
'track',
'disc',
'year',
'genre',
'lyrics',
'cover',
];
private const COLLECTABLE_TAGS = ['year', 'genre'];
public function handle(): int
{
$tags = collect($this->argument('tag'))->unique();
if ($tags->diff(self::COLLECTABLE_TAGS)->isNotEmpty()) {
$this->error(
sprintf(
'Invalid tag(s): %s. Allowed tags are: %s.',
$tags->diff(self::COLLECTABLE_TAGS)->join(', '),
implode(', ', self::COLLECTABLE_TAGS)
)
);
return self::FAILURE;
}
Song::withoutSyncingToSearch(function () use ($tags): void {
$this->call('koel:sync', [
'--force' => true,
'--ignore' => collect(self::ALL_TAGS)->diff($tags)->all(),
]);
});
return self::SUCCESS;
}
}
?>
Did this file decode correctly?
Original Code
<?php
namespace App\Console\Commands;
use App\Models\Song;
use Illuminate\Console\Command;
class CollectTagsCommand extends Command
{
protected $signature = 'koel:tags:collect {tag*}';
protected $description = 'Collect additional tags from existing songs';
private const ALL_TAGS = [
'title',
'album',
'artist',
'albumartist',
'track',
'disc',
'year',
'genre',
'lyrics',
'cover',
];
private const COLLECTABLE_TAGS = ['year', 'genre'];
public function handle(): int
{
$tags = collect($this->argument('tag'))->unique();
if ($tags->diff(self::COLLECTABLE_TAGS)->isNotEmpty()) {
$this->error(
sprintf(
'Invalid tag(s): %s. Allowed tags are: %s.',
$tags->diff(self::COLLECTABLE_TAGS)->join(', '),
implode(', ', self::COLLECTABLE_TAGS)
)
);
return self::FAILURE;
}
Song::withoutSyncingToSearch(function () use ($tags): void {
$this->call('koel:sync', [
'--force' => true,
'--ignore' => collect(self::ALL_TAGS)->diff($tags)->all(),
]);
});
return self::SUCCESS;
}
}
Function Calls
None |
Stats
MD5 | 9e01461f1a675a74e79ffd0fdb23d217 |
Eval Count | 0 |
Decode Time | 93 ms |