| Conditions | 11 |
| Paths | 12 |
| Total Lines | 42 |
| Code Lines | 24 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 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 |
||
| 136 | public function getOwnerPage() |
||
| 137 | { |
||
| 138 | if ($this->OwnerClassName) { |
||
| 139 | $class = $this->OwnerClassName; |
||
| 140 | $instance = Injector::inst()->get($class); |
||
| 141 | if (!ClassInfo::hasMethod($instance, 'getElementalRelations')) { |
||
| 142 | return; |
||
| 143 | } |
||
| 144 | $elementalAreaRelations = $instance->getElementalRelations(); |
||
| 145 | |||
| 146 | foreach ($elementalAreaRelations as $eaRelationship) { |
||
| 147 | $areaID = $eaRelationship . 'ID'; |
||
| 148 | |||
| 149 | $page = Versioned::get_by_stage($class, Versioned::get_stage())->filter($areaID, $this->ID); |
||
| 150 | |||
| 151 | if ($page && $page->exists()) { |
||
| 152 | return $page->first(); |
||
| 153 | } |
||
| 154 | } |
||
| 155 | } |
||
| 156 | |||
| 157 | foreach ($this->supportedPageTypes() as $class) { |
||
| 158 | $instance = Injector::inst()->get($class); |
||
| 159 | if (!ClassInfo::hasMethod($instance, 'getElementalRelations')) { |
||
| 160 | return; |
||
| 161 | } |
||
| 162 | $elementalAreaRelations = $instance->getElementalRelations(); |
||
| 163 | |||
| 164 | foreach ($elementalAreaRelations as $eaRelationship) { |
||
| 165 | $areaID = $eaRelationship . 'ID'; |
||
| 166 | $page = Versioned::get_by_stage($class, Versioned::DRAFT)->filter($areaID, $this->ID); |
||
| 167 | |||
| 168 | if ($page && $page->exists()) { |
||
| 169 | $this->OwnerClassName = $class; |
||
| 170 | $this->write(); |
||
| 171 | |||
| 172 | return $page->first(); |
||
| 173 | } |
||
| 174 | } |
||
| 175 | } |
||
| 176 | |||
| 177 | return false; |
||
| 178 | } |
||
| 196 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths