Conditions | 13 |
Paths | 193 |
Total Lines | 52 |
Code Lines | 28 |
Lines | 0 |
Ratio | 0 % |
Changes | 13 | ||
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 | self::$_can_cache_content_string = ''; |
||
49 | if ($owner->hasMethod('canCachePage')) { |
||
50 | // if it can cache the page, then it the cache string will remain empty. |
||
51 | self::$_can_cache_content_string .= $owner->canCachePage() ? '' : $this->getRandomKey(); |
||
52 | } |
||
53 | |||
54 | //action |
||
55 | $action = $owner->request->param('Action'); |
||
56 | if ($action) { |
||
57 | self::$_can_cache_content_string .= 'UA'.$action; |
||
58 | } |
||
59 | |||
60 | // id |
||
61 | $id = $owner->request->param('ID'); |
||
62 | if ($id) { |
||
63 | self::$_can_cache_content_string .= 'UI'.$id; |
||
64 | } |
||
65 | |||
66 | // otherid |
||
67 | $otherId = $owner->request->param('OtherID'); |
||
68 | if ($otherId) { |
||
69 | self::$_can_cache_content_string .= 'UI'.$otherId; |
||
70 | } |
||
71 | |||
72 | //request vars |
||
73 | $requestVars = $owner->request->requestVars(); |
||
74 | if ($requestVars) { |
||
75 | foreach ($owner->request->requestVars() as $key => $item) { |
||
76 | self::$_can_cache_content_string .= serialize($key.$item); |
||
77 | } |
||
78 | } |
||
79 | |||
80 | //member |
||
81 | $member = Security::getCurrentUser(); |
||
82 | if ($member && $member->exists()) { |
||
83 | if(Config::inst()->get(self::class, 'unique_cache_for_each_member')) { |
||
84 | self::$_can_cache_content_string .= 'UM'.$member->ID; |
||
85 | } elseif(Config::inst()->get(self::class, 'unique_cache_for_each_member_group_combo')) { |
||
86 | $groupIds = $member->Groups()->columnUnique(); |
||
87 | sort($groupIds, SORT_NUMERIC); |
||
88 | self::$_can_cache_content_string .= 'UG'.implode(',', $groupIds); |
||
89 | } |
||
90 | } |
||
91 | // crucial |
||
92 | self::$_can_cache_content = ('' === trim(self::$_can_cache_content_string)); |
||
93 | } |
||
94 | |||
95 | return self::$_can_cache_content; |
||
96 | } |
||
201 |
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