Conditions | 12 |
Paths | 12 |
Total Lines | 38 |
Code Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
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 |
||
101 | public function Breadcrumbs( |
||
102 | $maxDepth = 20, |
||
103 | $unlinked = false, |
||
104 | $stopAtPageType = false, |
||
105 | $showHidden = false, |
||
106 | $delimiter = '»' |
||
107 | ) { |
||
108 | $page = $this; |
||
109 | $pages = []; |
||
110 | |||
111 | while ($page |
||
112 | && (!$maxDepth || count($pages) < $maxDepth) |
||
113 | && (!$stopAtPageType || $page->ClassName != $stopAtPageType) |
||
114 | ) { |
||
115 | if ($showHidden || $page->ShowInMenus || ($page->ID == $this->ID)) { |
||
116 | $pages[] = $page; |
||
117 | } |
||
118 | |||
119 | $page = $page->Parent; |
||
120 | } |
||
121 | |||
122 | // Add on the item we're currently showing. |
||
123 | $controller = Controller::curr(); |
||
124 | if ($controller) { |
||
125 | $request = $controller->getRequest(); |
||
126 | if ($request->param('Action') === 'show') { |
||
127 | $id = $request->param('ID'); |
||
128 | if ($id) { |
||
129 | $object = DataObject::get_by_id($this->getDataClass(), $id); |
||
130 | array_unshift($pages, $object); |
||
131 | } |
||
132 | } |
||
133 | } |
||
134 | |||
135 | $template = SSViewer::create('BreadcrumbsTemplate'); |
||
136 | |||
137 | return $template->process($this->customise(ArrayData::create([ |
||
138 | 'Pages' => ArrayList::create(array_reverse($pages)) |
||
139 | ]))); |
||
142 |
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