| 1 | <?php |
||
| 5 | trait LimitTrait |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * Return only a subset of items. Behaves similarly to MYSQL's |
||
| 9 | * "LIMIT" clause. |
||
| 10 | * (internally uses \LimitIterator). |
||
| 11 | * |
||
| 12 | * <code>p()->limit(5)</code> will return only the first five elements. |
||
| 13 | * <code>p()->limit(2, 5)</code> will skip 2 element, and return the next 5. |
||
| 14 | * |
||
| 15 | * @param $boundary1 |
||
| 16 | * @param bool $boundary2 |
||
| 17 | * |
||
| 18 | * @return \Pipes\Pipe |
||
| 19 | */ |
||
| 20 | public function limit($boundary1, $boundary2 = false) |
||
| 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
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.