Passed
Push — master ( 1df74a...ea97aa )
by bader
04:54
created

Kabsa::__call()   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
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 2
1
<?php
2
3
namespace Awssat\Kabsa\Traits;
4
5
use Illuminate\Database\Eloquent\Collection;
6
7
8
trait Kabsa
9
{
10
    public function getRows()
11
    {
12
        return $this->rows;
13
    }
14
15
    public static function all($columns = [])
0 ignored issues
show
Unused Code introduced by
The parameter $columns is not used and could be removed. ( Ignorable by Annotation )

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

15
    public static function all(/** @scrutinizer ignore-unused */ $columns = [])

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
16
    {
17
        self::unguard();
18
        $self = new self();
19
20
        return Collection::make($self->getRows() ?? [])->map(function ($row) { return new self($row); });
0 ignored issues
show
Unused Code introduced by
The call to Awssat\Kabsa\Traits\Kabsa::__construct() has too many arguments starting with $row. ( Ignorable by Annotation )

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

20
        return Collection::make($self->getRows() ?? [])->map(function ($row) { return /** @scrutinizer ignore-call */ new self($row); });

This check compares calls to functions or methods with their respective definitions. If the call has more 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.

Loading history...
21
    }
22
23
    public function __call($method, $parameters)
24
    {
25
        return $this->forwardCallTo(self::all(), $method, $parameters);
0 ignored issues
show
Bug introduced by
The method forwardCallTo() does not exist on Awssat\Kabsa\Traits\Kabsa. 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

25
        return $this->/** @scrutinizer ignore-call */ forwardCallTo(self::all(), $method, $parameters);
Loading history...
26
    }
27
}
28