awssat /
laravel-kabsa
| 1 | <?php |
||||
| 2 | |||||
| 3 | namespace Awssat\Kabsa\Traits; |
||||
| 4 | |||||
| 5 | use Illuminate\Database\Eloquent\Collection; |
||||
| 6 | |||||
| 7 | |||||
| 8 | trait Kabsa |
||||
| 9 | { |
||||
| 10 | /** |
||||
| 11 | * @var Collection |
||||
| 12 | */ |
||||
| 13 | protected static $kabsaCollection; |
||||
| 14 | |||||
| 15 | public static function bootKabsa() |
||||
| 16 | { |
||||
| 17 | self::unguard(); |
||||
| 18 | } |
||||
| 19 | |||||
| 20 | public function getRows() |
||||
| 21 | { |
||||
| 22 | return $this->rows; |
||||
| 23 | } |
||||
| 24 | |||||
| 25 | public static function all($columns = []) |
||||
|
0 ignored issues
–
show
|
|||||
| 26 | { |
||||
| 27 | if(!empty(static::$kabsaCollection)) { |
||||
| 28 | return static::$kabsaCollection; |
||||
| 29 | } |
||||
| 30 | |||||
| 31 | return static::$kabsaCollection = Collection::make( |
||||
| 32 | (new static)->getRows() ?? []) |
||||
| 33 | ->map(function ($row) { |
||||
| 34 | return new static($row); |
||||
|
0 ignored issues
–
show
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
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...
|
|||||
| 35 | }); |
||||
| 36 | } |
||||
| 37 | |||||
| 38 | public static function addRow($row) |
||||
| 39 | { |
||||
| 40 | if(static::$kabsaCollection instanceof Collection) { |
||||
|
0 ignored issues
–
show
|
|||||
| 41 | static::$kabsaCollection->push(new static($row)); |
||||
|
0 ignored issues
–
show
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
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...
|
|||||
| 42 | } else { |
||||
| 43 | static::$kabsaCollection = Collection::make([new static($row)]); |
||||
| 44 | } |
||||
| 45 | |||||
| 46 | return true; |
||||
| 47 | } |
||||
| 48 | |||||
| 49 | public function __call($method, $parameters) |
||||
| 50 | { |
||||
| 51 | return $this->forwardCallTo(self::all(), $method, $parameters); |
||||
|
0 ignored issues
–
show
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
Loading history...
|
|||||
| 52 | } |
||||
| 53 | } |
||||
| 54 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.