for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Console\Commands;
use App\Jobs\ProcessResume;
use App\Models\Candidate;
use App\Models\Tenant;
use App\Services\TenantManager;
use Illuminate\Console\Command;
use Symfony\Component\Console\Exception\RuntimeException;
class ExtractPhotos extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'photo:extract {tenantId}';
* The console command description.
protected $description = 'Command description';
protected $tenantManager;
* Create a new command instance.
* @param TenantManager $tenantManager
public function __construct(TenantManager $tenantManager)
parent::__construct();
$this->tenantManager = $tenantManager;
}
* Execute the console command.
* @return mixed
public function handle()
$tenantId = $this->argument('tenantId');
$tenant = Tenant::find($tenantId);
if (!$tenant) {
throw new RuntimeException('Tenant with ID = '.$tenantId.' does not exist.');
$tenantId
array|null|string
concatenation
If this is a false-positive, you can also ignore this issue in your code via the ignore-type annotation
ignore-type
throw new RuntimeException('Tenant with ID = './** @scrutinizer ignore-type */ $tenantId.' does not exist.');
$this->tenantManager->setTenant($tenant);
\DB::purge('tenant');
$candidates = Candidate::whereNull('photo_extraction')->where('path_to_cv', '<>', '')->get();
foreach ($candidates as $candidate) {
$this->info('Parsing candidate id '.$candidate->id);
ProcessResume::dispatchNow($candidate);
App\Jobs\ProcessResume::dispatchNow()
If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated annotation
ignore-deprecated
/** @scrutinizer ignore-deprecated */ ProcessResume::dispatchNow($candidate);
This function has been deprecated. The supplier of the function has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.
gc_collect_cycles();