Conditions | 2 |
Paths | 2 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 12 |
Ratio | 100 % |
Changes | 1 | ||
Bugs | 1 | Features | 1 |
1 | <?php |
||
51 | View Code Duplication | private function doEdit() |
|
52 | { |
||
53 | if (is_callable(array('self', 'save'))) { |
||
54 | $this->save(); |
||
55 | |||
56 | event(new ModelEdit($this)); |
||
57 | |||
58 | return; |
||
59 | } |
||
60 | |||
61 | throw new WriteableException('For a Model to be Editable the ModelAdmin must have the Save method implemented using the ModelWriting trait', 1); |
||
62 | } |
||
63 | |||
73 |
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.