| 1 | <?php |
||
| 14 | trait RequestEndpoint |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * Đường dẫn giao tiếp với VNPay ở môi trường production. |
||
| 18 | * |
||
| 19 | * @var string |
||
| 20 | */ |
||
| 21 | protected $productionEndpoint; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Đường dẫn giao tiếp với VNPay ở môi trường test. |
||
| 25 | * |
||
| 26 | * @var string |
||
| 27 | */ |
||
| 28 | protected $testEndpoint; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Trả về url kết nối VNPay. |
||
| 32 | * |
||
| 33 | * @return string |
||
| 34 | */ |
||
| 35 | protected function getEndpoint(): string |
||
| 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.