1 | <?php namespace Arcanedev\Support\Providers\Concerns; |
||
9 | trait HasViews |
||
10 | { |
||
11 | /* ----------------------------------------------------------------- |
||
12 | | Main Methods |
||
13 | | ----------------------------------------------------------------- |
||
14 | */ |
||
15 | |||
16 | /** |
||
17 | * Get the base views path. |
||
18 | * |
||
19 | * @return string |
||
20 | */ |
||
21 | protected function getViewsPath() |
||
25 | |||
26 | /** |
||
27 | * Get the destination views path. |
||
28 | * |
||
29 | * @return string |
||
30 | */ |
||
31 | protected function getViewsDestinationPath() |
||
35 | |||
36 | /** |
||
37 | * Publish and load the views if $load argument is true. |
||
38 | * |
||
39 | * @param bool $load |
||
40 | */ |
||
41 | protected function publishViews($load = true) |
||
50 | |||
51 | /** |
||
52 | * Load the views files. |
||
53 | */ |
||
54 | protected function loadViews() |
||
58 | } |
||
59 |
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.