Passed
Push — feature/permissions-management ( 3c8a9f...1cc208 )
by Harings
19:21 queued 10s
created

ReorderNestedModuleItems::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 4
rs 10
1
<?php
2
3
namespace A17\Twill\Jobs;
4
5
6
use Illuminate\Bus\Queueable;
7
use Illuminate\Contracts\Queue\ShouldQueue;
8
use Illuminate\Foundation\Bus\Dispatchable;
9
use Illuminate\Queue\InteractsWithQueue;
10
use Illuminate\Support\Facades\DB;
11
use A17\Twill\Models\Model;
12
13
class ReorderNestedModuleItems implements ShouldQueue
14
{
15
    use Dispatchable, InteractsWithQueue, Queueable;
16
17
    protected $modelClass;
18
    protected $ids;
19
20
    public function __construct(Model $model, array $ids)
21
    {
22
        $this->modelClass = get_class($model);
23
        $this->ids = $ids;
24
    }
25
26
    public function handle()
27
    {
28
        DB::transaction(function () {
29
            app($this->modelClass)->saveTreeFromIds($this->ids);
0 ignored issues
show
Bug introduced by
The method saveTreeFromIds() does not exist on Illuminate\Contracts\Foundation\Application. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

29
            app($this->modelClass)->/** @scrutinizer ignore-call */ saveTreeFromIds($this->ids);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
30
        }, 3);
31
    }
32
}
33