IndexModel::handle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
namespace MAbadir\ElasticLaravel\Jobs;
4
5
use Illuminate\Bus\Queueable;
6
use Illuminate\Queue\SerializesModels;
7
use Illuminate\Queue\InteractsWithQueue;
8
use Illuminate\Contracts\Queue\ShouldQueue;
9
use MAbadir\ElasticLaravel\ElasticClient;
10
11
class IndexModel implements ShouldQueue
12
{
13
    use InteractsWithQueue, Queueable, SerializesModels;
14
15
    public $model, $params, $operation;
0 ignored issues
show
Coding Style introduced by
It is generally advisable to only define one property per statement.

Only declaring a single property per statement allows you to later on add doc comments more easily.

It is also recommended by PSR2, so it is a common style that many people expect.

Loading history...
16
    /**
17
     * Create a new job instance.
18
     *
19
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
20
     */
21
    public function __construct($model, $params, $operation)
22
    {
23
        $this->model = $model;
24
        $this->params = $params;
25
        $this->operation = $operation;
26
    }
27
28
    /**
29
     * Execute the job.
30
     *
31
     * @return void
32
     */
33
    public function handle()
34
    {
35
        $client = new ElasticClient();
36
        $client->{$this->operation}($this->params);
37
    }
38
}
39