| Conditions | 3 |
| Paths | 4 |
| Total Lines | 12 |
| Code Lines | 7 |
| Lines | 12 |
| Ratio | 100 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 27 | View Code Duplication | public function concat($iterable) |
|
| 28 | { |
||
| 29 | if (is_array($iterable)) { |
||
| 30 | $iterable = new ImmArrayList($iterable); |
||
| 31 | } |
||
| 32 | |||
| 33 | if ($iterable instanceof \Traversable) { |
||
| 34 | return new ImmArrayList(new LazyConcatIterator($this, $iterable)); |
||
| 35 | } else { |
||
| 36 | throw new \InvalidArgumentException('Parameter must be an array or an instance of Traversable'); |
||
| 37 | } |
||
| 38 | } |
||
| 39 | } |
||
| 40 |
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
Idableprovides a methodequalsIdthat 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.