| Conditions | 11 |
| Paths | 49 |
| Total Lines | 50 |
| Code Lines | 39 |
| 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 = ''; |
||
| 60 | if ($route) { |
||
| 61 | $uri = $this->router->generate($route, ['identifier' => $id, 'id' => $this->gridSourceId]); |
||
| 62 | $uri = htmlspecialchars($uri); |
||
| 63 | } |
||
| 64 | $content .= '<button class="btn'; |
||
| 65 | if (isset($options['button_class'])) { |
||
| 66 | $content .= ' '.htmlspecialchars($options['button_class']); |
||
| 67 | } |
||
| 68 | $content .= "\" data-route=\"$uri\" data-id=\"$idHtml\""; |
||
| 69 | if (isset($options['onclick'])) { |
||
| 70 | $content .= ' onclick="'.htmlspecialchars($options['onclick']).'"'; |
||
| 71 | } |
||
| 72 | $content .= ">$label</button>"; |
||
| 73 | } |
||
| 74 | } |
||
| 75 | |||
| 76 | return $content; |
||
| 77 | } |
||
| 89 |
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