| Conditions | 15 |
| Paths | 385 |
| Total Lines | 65 |
| Code Lines | 38 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 17 | ||
| 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 |
||
| 44 | public function HasCacheKeys(): bool |
||
| 45 | { |
||
| 46 | $owner = $this->getOwner(); |
||
| 47 | if (null === self::$_can_cache_content) { |
||
| 48 | $canCache = true; |
||
| 49 | self::$_can_cache_content_string = ''; |
||
| 50 | if ($owner->hasMethod('canCachePage')) { |
||
| 51 | // if it can cache the page, then it the cache string will remain empty. |
||
| 52 | $canCache = $owner->canCachePage(); |
||
| 53 | self::$_can_cache_content_string .= $canCache ? '' : $this->getRandomKey(); |
||
| 54 | } |
||
| 55 | |||
| 56 | //action |
||
| 57 | $action = $owner->request->param('Action'); |
||
| 58 | if ($action) { |
||
| 59 | self::$_can_cache_content_string .= 'UA' . $action; |
||
| 60 | } |
||
| 61 | |||
| 62 | // id |
||
| 63 | $id = $owner->request->param('ID'); |
||
| 64 | if ($id) { |
||
| 65 | self::$_can_cache_content_string .= 'UI' . $id; |
||
| 66 | } |
||
| 67 | |||
| 68 | // otherid |
||
| 69 | $otherId = $owner->request->param('OtherID'); |
||
| 70 | if ($otherId) { |
||
| 71 | self::$_can_cache_content_string .= 'OI' . $otherId; |
||
| 72 | } |
||
| 73 | |||
| 74 | //request vars |
||
| 75 | $requestVars = $owner->request->requestVars(); |
||
| 76 | if ($requestVars) { |
||
| 77 | $canCache = false; |
||
| 78 | foreach ($requestVars as $key => $item) { |
||
| 79 | if (! $item) { |
||
| 80 | $item = ''; |
||
| 81 | } |
||
| 82 | self::$_can_cache_content_string .= serialize($key . '_' . serialize($item)); |
||
| 83 | } |
||
| 84 | } |
||
| 85 | |||
| 86 | if (Versioned::get_reading_mode() !== 'Stage.Live') { |
||
| 87 | self::$_can_cache_content_string .= 'V' . Versioned::get_reading_mode(); |
||
| 88 | $canCache = false; |
||
| 89 | } |
||
| 90 | |||
| 91 | //member |
||
| 92 | $member = Security::getCurrentUser(); |
||
| 93 | if ($member && $member->exists()) { |
||
| 94 | if (Config::inst()->get(self::class, 'unique_cache_for_each_member')) { |
||
| 95 | self::$_can_cache_content_string .= 'UM' . $member->ID; |
||
| 96 | } elseif (Config::inst()->get(self::class, 'unique_cache_for_each_member_group_combo')) { |
||
| 97 | $groupIds = $member->Groups()->columnUnique(); |
||
| 98 | sort($groupIds, SORT_NUMERIC); |
||
| 99 | self::$_can_cache_content_string .= 'UG' . implode(',', $groupIds); |
||
| 100 | } else { |
||
| 101 | $canCache = false; |
||
| 102 | } |
||
| 103 | } |
||
| 104 | // crucial |
||
| 105 | self::$_can_cache_content = (bool) $canCache; |
||
| 106 | } |
||
| 107 | |||
| 108 | return self::$_can_cache_content; |
||
| 109 | } |
||
| 224 |
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