Total Complexity | 7 |
Total Lines | 44 |
Duplicated Lines | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | trait Kabsa |
||
9 | { |
||
10 | /** |
||
11 | * @var Collection |
||
12 | */ |
||
13 | protected static $kabsaCollection; |
||
14 | |||
15 | public static function bootKabsa() |
||
18 | } |
||
19 | |||
20 | public function getRows() |
||
21 | { |
||
22 | return $this->rows; |
||
23 | } |
||
24 | |||
25 | public static function all($columns = []) |
||
|
|||
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); |
||
35 | }); |
||
36 | } |
||
37 | |||
38 | public static function addRow($row) |
||
39 | { |
||
40 | if(static::$kabsaCollection instanceof Collection) { |
||
41 | static::$kabsaCollection->push(new static($row)); |
||
42 | } else { |
||
43 | static::$kabsaCollection = Collection::make([new static($row)]); |
||
44 | } |
||
45 | |||
46 | return true; |
||
47 | } |
||
48 | |||
49 | public function __call($method, $parameters) |
||
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.