| 1 | <?php |
||
| 15 | trait Parameters |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * Trả về mã website. |
||
| 19 | * |
||
| 20 | * @return null|string |
||
| 21 | */ |
||
| 22 | public function getWebsiteId(): ?string |
||
| 26 | |||
| 27 | /** |
||
| 28 | * Thiết lập mã website. |
||
| 29 | * |
||
| 30 | * @param null|string $id |
||
| 31 | * |
||
| 32 | * @return $this |
||
| 33 | */ |
||
| 34 | public function setWebsiteId(?string $id) |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Trả về mã bảo mật. |
||
| 41 | * |
||
| 42 | * @return null|string |
||
| 43 | */ |
||
| 44 | public function getSecurityCode(): ?string |
||
| 48 | |||
| 49 | /** |
||
| 50 | * Thiết lập mã bảo mật dùng để tạo chữ ký dữ liệu. |
||
| 51 | * |
||
| 52 | * @param string $code |
||
| 53 | * |
||
| 54 | * @return $this |
||
| 55 | */ |
||
| 56 | public function setSecurityCode(?string $code) |
||
| 60 | } |
||
| 61 |
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.