Conditions | 10 |
Paths | 33 |
Total Lines | 47 |
Code Lines | 37 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 1 | 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 |
||
27 | public function format($object, GridSourceInterface $gridsource) |
||
28 | { |
||
29 | $method = 'get'.ucfirst($this->idField); |
||
30 | $id = $object->$method(); |
||
31 | $idHtml = htmlspecialchars($id); |
||
32 | $content = ''; |
||
33 | foreach ($this->actions as $action => $options) { |
||
34 | $label = $options['label']; |
||
35 | if ($content) { |
||
36 | $content .= ' '; |
||
37 | } |
||
38 | $route = isset($options['route']) ? $options['route'] : ''; |
||
39 | switch ($options['action']) { |
||
40 | case 'show': |
||
41 | if (!$route) { |
||
42 | $route = 'dtc_grid_show'; |
||
43 | } |
||
44 | $uri = $this->router->generate($route, ['identifier' => $id, 'id' => $this->gridSourceId]); |
||
45 | $uri = htmlspecialchars($uri); |
||
46 | $content .= "<button class=\"btn btn-primary grid-show\" data-route=\"$uri\" data-id=\"$idHtml\""; |
||
47 | $content .= "onclick=\"dtc_grid_show(this)\">$label</button>"; |
||
48 | break; |
||
49 | case 'delete': |
||
50 | if (!$route) { |
||
51 | $route = 'dtc_grid_delete'; |
||
52 | } |
||
53 | $uri = $this->router->generate($route, ['identifier' => $id, 'id' => $this->gridSourceId]); |
||
54 | $uri = htmlspecialchars($uri); |
||
55 | $content .= "<button class=\"btn btn-primary grid-delete\" data-route=\"$uri\" data-id=\"$idHtml\""; |
||
56 | $content .= "onclick=\"dtc_grid_delete(this)\">" . static::$spinnerHtml . "$label</button>"; |
||
57 | break; |
||
58 | default: |
||
59 | $uri = $this->router->generate($route, ['identifier' => $id, 'id' => $this->gridSourceId]); |
||
60 | $uri = htmlspecialchars($uri); |
||
61 | $content .= "<button class \""; |
||
62 | if (isset($options['button_class'])) { |
||
63 | $content .= " " . $options['button_class']; |
||
64 | } |
||
65 | $content .= " data-route=\"$uri\" data-id=\"$idHtml\""; |
||
66 | if (isset($options['onclick'])) { |
||
67 | $content .= " onclick=\"" . htmlspecialchars($options['onclick']) . "\""; |
||
68 | } |
||
69 | $content .= ">$label</button>"; |
||
70 | } |
||
71 | } |
||
72 | |||
73 | return $content; |
||
74 | } |
||
86 |
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