| Conditions | 3 |
| Paths | 3 |
| Total Lines | 14 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 59 | */ |
||
| 60 | 3 | public function reverse(){ |
|
| 61 | 3 | $this->array = array_reverse($this->array); |
|
| 62 | 3 | $this->rewind(); |
|
| 63 | |||
| 64 | 3 | return $this; |
|
| 65 | } |
||
| 66 | |||
| 67 | /** |
||
| 68 | * @link http://api.prototypejs.org/language/Enumerable/prototype/toArray/ |
||
| 69 | * |
||
| 70 | * @return array |
||
| 71 | */ |
||
| 72 | 1 | public function toArray():array { |
|
| 73 | 1 | return $this->array; |
|
| 77 |
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.