Conditions | 10 |
Paths | 168 |
Total Lines | 42 |
Code Lines | 32 |
Lines | 0 |
Ratio | 0 % |
Changes | 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 |
||
107 | public function viewAction() { |
||
108 | $args = func_get_args(); |
||
109 | $alias = trim(implode('/', $args)); |
||
110 | $material = false; |
||
111 | if ($alias) { |
||
112 | if (is_numeric($alias)) { |
||
113 | $material = Materials\Material::get([['id', (int) $alias], ['date_publish', null, 'IS NOT']]); |
||
114 | } |
||
115 | if (!$material) { |
||
116 | $material = Materials\Material::get([['alias', $alias], ['date_publish', null, 'IS NOT']]); |
||
117 | if (!$material) { |
||
118 | Tools::header('404'); |
||
119 | $this->view->page([ |
||
120 | 'content' => '404', |
||
121 | 'data' => ['text' => 'Такой страницы не найдено'] |
||
122 | ]); |
||
123 | } |
||
124 | } |
||
125 | } |
||
126 | if ($material->keywords) { |
||
127 | $this->view->addMetaTag(['name' => 'keywords', 'content' => $material->keywords]); |
||
128 | } |
||
129 | if ($material->description) { |
||
130 | $this->view->addMetaTag(['name' => 'description', 'content' => $material->description]); |
||
131 | } |
||
132 | $this->view->addMetaTag(['property' => 'og:title', 'content' => $material->name]); |
||
133 | $this->view->addMetaTag(['property' => 'og:url', 'content' => 'http://' . idn_to_utf8(INJI_DOMAIN_NAME) . '/' . $material->alias]); |
||
134 | if ($material->description) { |
||
135 | $this->view->addMetaTag(['property' => 'og:description', 'content' => 'http://' . idn_to_utf8(INJI_DOMAIN_NAME) . '/' . $material->description]); |
||
136 | } |
||
137 | if ($material->image) { |
||
138 | $this->view->addMetaTag(['property' => 'og:image', 'content' => 'http://' . idn_to_utf8(INJI_DOMAIN_NAME) . $material->image->path]); |
||
139 | } elseif ($logo = Files\File::get('site_logo', 'code')) { |
||
140 | $this->view->addMetaTag(['property' => 'og:image', 'content' => 'http://' . idn_to_utf8(INJI_DOMAIN_NAME) . $logo->path]); |
||
141 | } |
||
142 | $this->view->setTitle($material->name); |
||
143 | $bread = []; |
||
144 | $bread[] = ['text' => $material->name, 'href' => '/' . $material->alias]; |
||
145 | $this->view->page([ |
||
146 | 'page' => $material->resolveTemplate(), |
||
147 | 'content' => $material->resolveViewer(), |
||
148 | 'data' => compact('material', 'bread'), |
||
149 | ]); |
||
160 | } |
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