Conditions | 10 |
Paths | 37 |
Total Lines | 27 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
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 |
||
23 | protected function resolveItem($item, array $args, ResolveContext $context, ResolveInfo $info) { |
||
24 | if ($item instanceof FieldItemInterface) { |
||
25 | $definition = $this->getPluginDefinition(); |
||
26 | $property = $definition['property']; |
||
27 | $itemProperty = $item->get($property); |
||
28 | $result = $itemProperty->getValue(); |
||
29 | $result = $result instanceof MarkupInterface ? $result->__toString() : $result; |
||
30 | |||
31 | $type = $info->returnType; |
||
32 | $type = $type instanceof WrappingType ? $type->getWrappedType(TRUE) : $type; |
||
33 | if ($type instanceof ScalarType) { |
||
34 | $result = is_null($result) ? NULL : $type->serialize($result); |
||
35 | } |
||
36 | |||
37 | if ($result instanceof ContentEntityInterface && $result->isTranslatable() && $language = $context->getContext('language', $info)) { |
||
38 | if ($result->hasTranslation($language)) { |
||
39 | $result = $result->getTranslation($language); |
||
40 | } |
||
41 | } |
||
42 | |||
43 | // if ($itemProperty instanceof CacheableDependencyInterface) { |
||
44 | // $context->addCacheTags($itemProperty->getCacheTags()); |
||
45 | // $context->addCacheContexts($itemProperty->getCacheContexts()); |
||
46 | // $context->mergeCacheMaxAge($itemProperty->getCacheMaxAge()); |
||
47 | // } |
||
48 | |||
49 | return $result; |
||
50 | } |
||
54 |
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