Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Passed
Push — crud-uploads ( fa10c4...76b561 )
by Pedro
17:52 queued 02:57
created

MacroableWithAttributes::getMacros()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Backpack\CRUD\app\Library\CrudPanel\Traits\Support;
4
5
use Illuminate\Support\Traits\Macroable;
6
7
trait MacroableWithAttributes
8
{
9
    use Macroable {
10
        __call as macroCall;
11
    }
12
13
    /**
14
     * The registered string macros.
15
     *
16
     * @var array
17
     */
18
    protected static $macros = [];
19
20
    /**
21
     * Get the registered macros.
22
     *
23
     * @var array
24
     */
25
    public function getMacros()
26
    {
27
        return static::$macros;
28
    }
29
30
    /**
31
     * Call the macros registered for the given macroable attributes.
32
     *
33
     * @return void
34
     */
35
    public function callRegisteredAttributeMacros()
36
    {
37
        $macros = $this->getMacros();
38
        $attributes = $this->getAttributes();
0 ignored issues
show
Bug introduced by
The method getAttributes() does not exist on Backpack\CRUD\app\Librar...MacroableWithAttributes. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

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

38
        /** @scrutinizer ignore-call */ 
39
        $attributes = $this->getAttributes();
Loading history...
39
40
        foreach (array_keys($macros) as $macro) {
41
            if (isset($attributes[$macro])) {
42
                $this->{$macro}($attributes[$macro]);
43
44
                continue;
45
            }
46
            if (isset($attributes['subfields'])) {
47
                foreach ($attributes['subfields'] as $subfield) {
48
                    if (isset($subfield[$macro])) {
49
                        $config = ! is_array($subfield[$macro]) ? [] : $subfield[$macro];
50
                        $this->{$macro}($config, $subfield);
51
                    }
52
                }
53
            }
54
        }
55
    }
56
57
}