1 | <?php namespace crocodicstudio\crudbooster\commands; |
||||||
2 | |||||||
3 | use Cache; |
||||||
4 | use CRUDBooster; |
||||||
0 ignored issues
–
show
|
|||||||
5 | use DB; |
||||||
6 | use Illuminate\Console\Command; |
||||||
7 | use Request; |
||||||
8 | |||||||
9 | class Mailqueues extends Command |
||||||
10 | { |
||||||
11 | /** |
||||||
12 | * The console command name. |
||||||
13 | * |
||||||
14 | * @var string |
||||||
15 | */ |
||||||
16 | protected $name = 'mailqueues'; |
||||||
17 | |||||||
18 | /** |
||||||
19 | * The console command description. |
||||||
20 | * |
||||||
21 | * @var string |
||||||
22 | */ |
||||||
23 | protected $description = 'Run Mail Queues'; |
||||||
24 | |||||||
25 | /** |
||||||
26 | * Execute the console command. |
||||||
27 | * |
||||||
28 | * @return mixed |
||||||
29 | */ |
||||||
30 | public function handle() |
||||||
31 | { |
||||||
32 | |||||||
33 | |||||||
34 | $now = date('Y-m-d H:i:s'); |
||||||
35 | |||||||
36 | $this->comment('Mail Queues Started '.$now); |
||||||
37 | |||||||
38 | $queues = DB::table('cms_email_queues')->where('send_at', '<=', $now)->take($limit_an_hour)->get(); |
||||||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||||||
39 | |||||||
40 | $this->comment('Total Queues : '.count($queues)); |
||||||
41 | |||||||
42 | Cache::increment('total_email_sent', count($queues)); |
||||||
43 | Cache::put('last_email_sent', date('Y-m-d H:i:s')); |
||||||
0 ignored issues
–
show
The call to
Illuminate\Support\Facades\Cache::put() has too few arguments starting with ttl .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above. ![]() |
|||||||
44 | |||||||
45 | foreach ($queues as $q) { |
||||||
46 | if (filter_var($q->email_recipient, FILTER_VALIDATE_EMAIL) !== false) { |
||||||
47 | CRUDBooster::sendEmailQueue($queue); |
||||||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||||||
48 | $this->comment('Email send -> '.$q->subject); |
||||||
49 | } |
||||||
50 | DB::table('mailqueues')->where('id', $q->id)->delete(); |
||||||
51 | } |
||||||
52 | } |
||||||
53 | } |
||||||
54 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths