| Conditions | 3 |
| Paths | 2 |
| Total Lines | 11 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php namespace Afrittella\BackProject\Traits; |
||
| 14 | public function confirm($code) |
||
| 15 | { |
||
| 16 | if ($this->{$this->confirmation_token_field} == $code && $this->isPendingConfirmation()) { |
||
| 17 | $this->{$this->confirmation_token_field} = null; |
||
| 18 | $this->{$this->confirmation_field} = 1; |
||
| 19 | $this->save(); |
||
|
|
|||
| 20 | return true; |
||
| 21 | } |
||
| 22 | |||
| 23 | return false; |
||
| 24 | } |
||
| 25 | |||
| 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.