1 | <?php |
||||
2 | |||||
3 | namespace LivePersonInc\LiveEngageLaravel\Traits; |
||||
4 | |||||
5 | use LivePersonInc\LiveEngageLaravel\Facades\LiveEngageLaravel as LiveEngage; |
||||
6 | use LivePersonInc\LiveEngageLaravel\Models\MetaData; |
||||
7 | |||||
8 | /** |
||||
9 | * Pageable trait. |
||||
10 | */ |
||||
11 | trait Pageable |
||||
12 | { |
||||
13 | |||||
14 | /** |
||||
15 | * next function. |
||||
16 | * |
||||
17 | * @access public |
||||
18 | * @return mixed |
||||
19 | */ |
||||
20 | 2 | public function next() |
|||
21 | { |
||||
22 | /** @scrutinizer ignore-call */ |
||||
23 | 2 | if ($this->metaData->next) { |
|||
24 | /** @scrutinizer ignore-call */ |
||||
25 | 2 | $func = $this->historyFunction; |
|||
26 | 2 | $next = LiveEngage::$func($this->metaData->start, $this->metaData->end, $this->metaData->next->href); |
|||
27 | 2 | if ($next) { |
|||
28 | |||||
29 | 2 | $next->_metadata->start = $this->metaData->start; |
|||
30 | 2 | $next->_metadata->end = $this->metaData->end; |
|||
31 | |||||
32 | 2 | $meta = new MetaData((array) $next->_metadata); |
|||
33 | |||||
34 | 2 | $collection = new self($next->records); |
|||
0 ignored issues
–
show
|
|||||
35 | 2 | $collection->metaData = $meta; |
|||
0 ignored issues
–
show
|
|||||
36 | |||||
37 | 2 | return $collection; |
|||
38 | |||||
39 | } else { |
||||
40 | return null; |
||||
41 | } |
||||
42 | } |
||||
43 | |||||
44 | 2 | return null; |
|||
45 | |||||
46 | } |
||||
47 | |||||
48 | /** |
||||
49 | * prev function. |
||||
50 | * |
||||
51 | * @access public |
||||
52 | * @return mixed |
||||
53 | */ |
||||
54 | 2 | public function prev() |
|||
55 | { |
||||
56 | /** @scrutinizer ignore-call */ |
||||
57 | 2 | if ($this->metaData->prev) { |
|||
58 | /** @scrutinizer ignore-call */ |
||||
59 | 2 | $func = $this->historyFunction; |
|||
60 | 2 | $prev = LiveEngage::$func($this->metaData->start, $this->metaData->end, $this->metaData->prev->href); |
|||
61 | 2 | if ($prev) { |
|||
62 | |||||
63 | 2 | $prev->_metadata->start = $this->metaData->start; |
|||
64 | 2 | $prev->_metadata->end = $this->metaData->end; |
|||
65 | |||||
66 | 2 | $meta = new MetaData((array) $prev->_metadata); |
|||
67 | |||||
68 | 2 | $collection = new self($prev->records); |
|||
0 ignored issues
–
show
The call to
LivePersonInc\LiveEngage...Pageable::__construct() has too many arguments starting with $prev->records .
(
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. ![]() |
|||||
69 | 2 | $collection->metaData = $meta; |
|||
0 ignored issues
–
show
|
|||||
70 | |||||
71 | 2 | return $collection; |
|||
72 | |||||
73 | } else { |
||||
74 | return null; |
||||
75 | } |
||||
76 | } |
||||
77 | |||||
78 | return null; |
||||
79 | |||||
80 | } |
||||
81 | |||||
82 | } |
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.