| Conditions | 12 | 
| Paths | 105 | 
| Total Lines | 38 | 
| Code Lines | 18 | 
| Lines | 24 | 
| Ratio | 63.16 % | 
| Changes | 3 | ||
| Bugs | 2 | Features | 0 | 
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php /** MicroAsset */ | ||
| 91 | public function publish() | ||
| 92 |     { | ||
| 93 |         foreach ($this->required AS $require) { | ||
| 94 |             if (!in_array($require, $this->published, true) && class_exists($require)) { | ||
| 95 | $this->published[] = $require; | ||
| 96 | |||
| 97 | /** @var Asset $require */ | ||
| 98 | $require = new $require($this->view); | ||
| 99 | $require->publish(); | ||
| 100 | } | ||
| 101 | } | ||
| 102 | |||
| 103 | View Code Duplication |         if ($this->js) { | |
| 104 |             if (is_string($this->js)) { | ||
| 105 | $this->js = [$this->js]; | ||
| 106 | } | ||
| 107 | |||
| 108 |             if (0 !== count($this->js)) { | ||
| 109 | /** @noinspection ForeachSourceInspection */ | ||
| 110 |                 foreach ($this->js AS $script) { | ||
| 111 | $this->view->registerScriptFile($this->publishPath . $script, $this->isHead); | ||
| 112 | } | ||
| 113 | } | ||
| 114 | } | ||
| 115 | |||
| 116 | View Code Duplication |         if ($this->css) { | |
| 117 |             if (is_string($this->css)) { | ||
| 118 | $this->css = [$this->css]; | ||
| 119 | } | ||
| 120 | |||
| 121 |             if (0 !== count($this->css)) { | ||
| 122 | /** @noinspection ForeachSourceInspection */ | ||
| 123 |                 foreach ($this->css AS $style) { | ||
| 124 | $this->view->registerCssFile($this->publishPath . $style, $this->isHead); | ||
| 125 | } | ||
| 126 | } | ||
| 127 | } | ||
| 128 | } | ||
| 129 | } | ||
| 130 | 
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)or! empty(...)instead.