| 1 | <?php namespace Afrittella\BackProject\Traits; |
||
| 9 | trait UserConfirmation |
||
| 10 | { |
||
| 11 | protected $confirmation_field = 'confirmed'; |
||
| 12 | protected $confirmation_token_field = 'confirmation_code'; |
||
| 13 | |||
| 14 | public function confirm($code) |
||
| 25 | |||
| 26 | public function isConfirmed() |
||
| 30 | |||
| 31 | public function hasConfirmationCode() |
||
| 35 | |||
| 36 | public function isPendingConfirmation() |
||
| 40 | |||
| 41 | public function getConfirmationField() |
||
| 45 | |||
| 46 | public function getConfirmationTokenField() |
||
| 50 | |||
| 51 | public function generateConfirmationCode() |
||
| 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.