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

Completed
Pull Request — master (#136)
by Owen
03:20
created

CrudInjectable   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 44
rs 10
wmc 9
lcom 1
cbo 1

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A with() 0 12 4
A inject() 0 6 2
A __call() 0 6 2
1
<?php
2
3
namespace Backpack\CRUD;
4
5
use Backpack\CRUD\Injectables\CheckUnique as CheckUnique;
6
7
class CrudInjectable
8
{
9
    use CheckUnique;
10
11
    protected $requiredInjectables = [];
12
13
    protected $name = null;
14
    protected $options = null;
15
    protected $controller = null;
16
17
    public function __construct($name, $controller, $options)
18
    {
19
        $this->name = $name;
20
        $this->options = $options;
21
        $this->controller = $controller;
22
    }
23
24
    public function with($injectables)
25
    {
26
        if (is_string($injectables)) {
27
            $this->requiredInjectables[] = 'with'.ucwords($injectables);
28
        } elseif (is_array($injectables)) {
29
            foreach ($injectables as $injectable) {
30
                $this->requiredInjectables = 'with'.ucwords($injectable);
0 ignored issues
show
Documentation Bug introduced by
It seems like 'with' . ucwords($injectable) of type string is incompatible with the declared type array of property $requiredInjectables.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
31
            }
32
        }
33
34
        return $this->inject();
35
    }
36
37
    private function inject()
38
    {
39
        foreach ($this->requiredInjectables as $injectable) {
40
            $this->{$injectable}();
41
        }
42
    }
43
44
    public function __call($method, $parameters = null)
45
    {
46
        if (method_exists($this, $method)) {
47
            $this->{$method}($parameters);
48
        }
49
    }
50
}
51