1 | <?php |
||
7 | trait AsFofocavel |
||
8 | { |
||
9 | |||
10 | /** |
||
11 | * One To Many (Polymorphic) - Feature FA |
||
12 | * |
||
13 | * @return void |
||
14 | */ |
||
15 | |||
16 | public function infos() |
||
20 | |||
21 | public function fatos() |
||
25 | |||
26 | /** |
||
27 | * Ajudantes que chamam outras funcoes |
||
28 | */ |
||
29 | public function setDiario($date, $text) |
||
38 | /** |
||
39 | * Construtores |
||
40 | */ |
||
41 | public function diario($date, $comment) |
||
46 | |||
47 | |||
48 | /** |
||
49 | * DataInfo do Usuario - @todo Refazer |
||
50 | * |
||
51 | * @param array $data |
||
52 | * @return void |
||
53 | */ |
||
54 | public function addDataInfo($data) |
||
63 | |||
64 | /** |
||
65 | * Events |
||
66 | */ |
||
67 | public static function bootAsFofocavel() |
||
76 | |||
77 | |||
78 | } |
||
79 |
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
Idable
provides a methodequalsId
that 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.