NNTmux /
newznab-tmux
| 1 | <?php |
||
| 2 | |||
| 3 | namespace App\Console\Commands; |
||
| 4 | |||
| 5 | use App\Services\ForkingService; |
||
| 6 | use Illuminate\Console\Command; |
||
| 7 | |||
| 8 | class ProcessPostProcess extends Command |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * The name and signature of the console command. |
||
| 12 | * |
||
| 13 | * @var string |
||
| 14 | */ |
||
| 15 | protected $signature = 'multiprocessing:postprocess |
||
| 16 | {type : Type: ama, add, ani, mov, nfo or tv} |
||
| 17 | {renamed=false : For mov/tv: only post-process renamed releases (true/false)}'; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * The console command description. |
||
| 21 | * |
||
| 22 | * @var string |
||
| 23 | */ |
||
| 24 | protected $description = 'Post-process releases using multiprocessing'; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Execute the console command. |
||
| 28 | */ |
||
| 29 | public function handle(): int |
||
| 30 | { |
||
| 31 | $this->warn('⚠️ WARNING: This command is to be used from cli.'); |
||
| 32 | $this->line(''); |
||
| 33 | |||
| 34 | $type = $this->argument('type'); |
||
| 35 | $renamed = $this->argument('renamed'); |
||
| 36 | |||
| 37 | if (! \in_array($type, ['ama', 'add', 'ani', 'mov', 'nfo', 'tv'], true)) { |
||
| 38 | $this->error('Type must be one of: ama, add, ani, mov, nfo, sha, tv'); |
||
| 39 | $this->line(''); |
||
| 40 | $this->line('ama => Do amazon/books processing'); |
||
| 41 | $this->line('add => Do additional (rar|zip) processing'); |
||
| 42 | $this->line('ani => Do anime processing'); |
||
| 43 | $this->line('mov => Do movie processing'); |
||
| 44 | $this->line('nfo => Do NFO processing'); |
||
| 45 | $this->line('tv => Do TV processing'); |
||
| 46 | |||
| 47 | return self::FAILURE; |
||
| 48 | } |
||
| 49 | |||
| 50 | try { |
||
| 51 | $renamedOnly = $renamed === 'true' || $renamed === true; |
||
| 52 | $service = new ForkingService; |
||
| 53 | |||
| 54 | match ($type) { |
||
| 55 | 'ama' => $service->processBooks(), |
||
|
0 ignored issues
–
show
|
|||
| 56 | 'add' => $service->processAdditional(), |
||
|
0 ignored issues
–
show
Are you sure the usage of
$service->processAdditional() targeting App\Services\ForkingService::processAdditional() seems to always return null.
This check looks for function or method calls that always return null and whose return value is used. class A
{
function getObject()
{
return null;
}
}
$a = new A();
if ($a->getObject()) {
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. Loading history...
|
|||
| 57 | 'ani' => $service->processAnime(), |
||
|
0 ignored issues
–
show
Are you sure the usage of
$service->processAnime() targeting App\Services\ForkingService::processAnime() seems to always return null.
This check looks for function or method calls that always return null and whose return value is used. class A
{
function getObject()
{
return null;
}
}
$a = new A();
if ($a->getObject()) {
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. Loading history...
|
|||
| 58 | 'mov' => $service->processMovies($renamedOnly), |
||
|
0 ignored issues
–
show
Are you sure the usage of
$service->processMovies($renamedOnly) targeting App\Services\ForkingService::processMovies() seems to always return null.
This check looks for function or method calls that always return null and whose return value is used. class A
{
function getObject()
{
return null;
}
}
$a = new A();
if ($a->getObject()) {
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. Loading history...
|
|||
| 59 | 'nfo' => $service->processNfo(), |
||
|
0 ignored issues
–
show
Are you sure the usage of
$service->processNfo() targeting App\Services\ForkingService::processNfo() seems to always return null.
This check looks for function or method calls that always return null and whose return value is used. class A
{
function getObject()
{
return null;
}
}
$a = new A();
if ($a->getObject()) {
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. Loading history...
|
|||
| 60 | 'tv' => $service->processTv($renamedOnly), |
||
|
0 ignored issues
–
show
Are you sure the usage of
$service->processTv($renamedOnly) targeting App\Services\ForkingService::processTv() seems to always return null.
This check looks for function or method calls that always return null and whose return value is used. class A
{
function getObject()
{
return null;
}
}
$a = new A();
if ($a->getObject()) {
The method The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes. Loading history...
|
|||
| 61 | }; |
||
| 62 | |||
| 63 | return self::SUCCESS; |
||
| 64 | } catch (\Exception $e) { |
||
| 65 | $this->error($e->getMessage()); |
||
| 66 | |||
| 67 | return self::FAILURE; |
||
| 68 | } |
||
| 69 | } |
||
| 70 | } |
||
| 71 |
This check looks for function or method calls that always return null and whose return value is used.
The method
getObject()can return nothing but null, so it makes no sense to use the return value.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.