Conditions | 4 |
Paths | 4 |
Total Lines | 15 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 5 | ||
Bugs | 1 | Features | 1 |
1 | <?php |
||
20 | public function limit($boundary1, $boundary2 = false) |
||
21 | { |
||
22 | if (func_num_args() == 1 || $boundary2 === false) { |
||
23 | $offset = 0; |
||
24 | $count = $boundary1; |
||
25 | } else { |
||
26 | $offset = $boundary1; |
||
27 | $count = $boundary2; |
||
28 | } |
||
29 | if (!$count) { |
||
30 | return $this->chainWith(new \ArrayIterator([])); |
||
|
|||
31 | } |
||
32 | |||
33 | return $this->chainWith(new \LimitIterator($this->toIterator(), $offset, $count)); |
||
34 | } |
||
35 | } |
||
36 |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idable
provides a methodequalsId
that in turn relies on the methodgetId()
. If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()
as an abstract method to the trait will make sure it is available.