| 1 | <?php |
||
| 15 | trait ShortsTrait |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * Alias for ->write() method |
||
| 19 | * |
||
| 20 | * @param string|array|\RouterOS\Query $query |
||
| 21 | * @return \RouterOS\Interfaces\ClientInterface |
||
| 22 | * @throws \RouterOS\Exceptions\QueryException |
||
| 23 | */ |
||
| 24 | 1 | public function w($query): ClientInterface |
|
| 28 | |||
| 29 | /** |
||
| 30 | * Alias for ->read() method |
||
| 31 | * |
||
| 32 | * @param bool $parse |
||
| 33 | * @return mixed |
||
| 34 | * @since 0.7 |
||
| 35 | */ |
||
| 36 | 1 | public function r(bool $parse = true) |
|
| 40 | |||
| 41 | /** |
||
| 42 | * Alias for ->write()->read() combination of methods |
||
| 43 | * |
||
| 44 | * @param string|array|\RouterOS\Query $query |
||
| 45 | * @param bool $parse |
||
| 46 | * @return array |
||
| 47 | * @throws \RouterOS\Exceptions\ClientException |
||
| 48 | * @throws \RouterOS\Exceptions\QueryException |
||
| 49 | * @since 0.6 |
||
| 50 | */ |
||
| 51 | 4 | public function wr($query, bool $parse = true): array |
|
| 55 | } |
||
| 56 |
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.