1 | <?php |
||
13 | abstract class Component implements ComponentInterface |
||
14 | { |
||
15 | use HasEvents, |
||
16 | HasPermission, |
||
17 | HasNavigation; |
||
18 | |||
19 | /** |
||
20 | * @var |
||
21 | */ |
||
22 | protected $name; |
||
23 | |||
24 | /** |
||
25 | * @var \Illuminate\Foundation\Application |
||
26 | */ |
||
27 | protected $app; |
||
28 | |||
29 | protected $title; |
||
30 | |||
31 | /** |
||
32 | * @var mixed|\Sco\Admin\Contracts\RepositoryInterface |
||
33 | */ |
||
34 | protected $repository; |
||
35 | |||
36 | /** |
||
37 | * @var \Illuminate\Database\Eloquent\Model |
||
38 | */ |
||
39 | protected $model; |
||
40 | |||
41 | protected static $booted = []; |
||
42 | |||
43 | /** |
||
44 | * @var \Illuminate\Contracts\Events\Dispatcher |
||
45 | */ |
||
46 | protected static $dispatcher; |
||
47 | |||
48 | public function __construct(Application $app, $modelClass) |
||
64 | |||
65 | protected function setDefaultName() |
||
69 | |||
70 | protected function getModelClassName() |
||
74 | |||
75 | public function getName() |
||
79 | |||
80 | public function getTitle() |
||
84 | |||
85 | public function getModel() |
||
89 | |||
90 | public function getRepository() |
||
94 | |||
95 | public function get() |
||
105 | |||
106 | |||
107 | /** |
||
108 | * {@inheritdoc} |
||
109 | */ |
||
110 | public function getConfigs() |
||
120 | |||
121 | /** |
||
122 | * @return \Sco\Admin\Contracts\ViewInterface |
||
123 | */ |
||
124 | protected function fireView() |
||
133 | |||
134 | protected function bootIfNotBooted() |
||
146 | |||
147 | public function boot() |
||
151 | } |
||
152 |
PHP Analyzer performs a side-effects analysis of your code. A side-effect is basically anything that might be visible after the scope of the method is left.
Let’s take a look at an example:
If we look at the
getEmail()
method, we can see that it has no side-effect. Whether you call this method or not, no future calls to other methods are affected by this. As such code as the following is useless:On the hand, if we look at the
setEmail()
, this method _has_ side-effects. In the following case, we could not remove the method call: