| Conditions | 10 |
| Paths | 17 |
| Total Lines | 45 |
| Code Lines | 24 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 4 | ||
| Bugs | 0 | 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 |
||
| 135 | public function getOwnerPage() |
||
| 136 | { |
||
| 137 | if ($this->OwnerClassName) { |
||
| 138 | $class = $this->OwnerClassName; |
||
| 139 | $elementalAreaRelations = Injector::inst()->get($class)->getElementalRelations(); |
||
| 140 | |||
| 141 | foreach ($elementalAreaRelations as $eaRelationship) { |
||
| 142 | $areaID = $eaRelationship . 'ID'; |
||
| 143 | |||
| 144 | $page = $class::get()->filter($areaID, $this->ID); |
||
| 145 | |||
| 146 | if ($page && $page->exists()) { |
||
| 147 | return $page->first(); |
||
| 148 | } |
||
| 149 | } |
||
| 150 | } |
||
| 151 | |||
| 152 | $originalMode = Versioned::get_stage(); |
||
| 153 | |||
| 154 | if (!$originalMode) { |
||
| 155 | $originalMode = Versioned::DRAFT; |
||
| 156 | } |
||
| 157 | |||
| 158 | Versioned::set_stage(Versioned::DRAFT); |
||
| 159 | |||
| 160 | foreach ($this->supportedPageTypes() as $class) { |
||
| 161 | $elementalAreaRelations = Injector::inst()->get($class)->getElementalRelations(); |
||
| 162 | |||
| 163 | foreach ($elementalAreaRelations as $eaRelationship) { |
||
| 164 | $areaID = $eaRelationship . 'ID'; |
||
| 165 | $page = $class::get()->filter($areaID, $this->ID); |
||
| 166 | |||
| 167 | if ($page && $page->exists()) { |
||
| 168 | Versioned::set_stage($originalMode); |
||
| 169 | $this->OwnerClassName = $class; |
||
| 170 | $this->write(); |
||
| 171 | |||
| 172 | return $page->first(); |
||
| 173 | } |
||
| 174 | } |
||
| 175 | } |
||
| 176 | |||
| 177 | Versioned::set_stage($originalMode); |
||
| 178 | |||
| 179 | return false; |
||
| 180 | } |
||
| 182 |
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