| Conditions | 13 |
| Paths | 56 |
| Total Lines | 68 |
| Code Lines | 58 |
| 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 |
||
| 62 | public function execAfterAction($action) |
||
| 63 | { |
||
| 64 | parent::execAfterAction($action); |
||
| 65 | $periodStartDate = \date('01-m-Y'); |
||
| 66 | $periodEndDate = \date('d-m-Y'); |
||
| 67 | if ($this->request->request->get('filterfecha') !== null) { |
||
| 68 | PeriodTools::applyPeriod($this->request->request->get('filterfecha'), $periodStartDate, $periodEndDate); |
||
| 69 | } |
||
| 70 | $startDate = ($this->request->request->get('filterstartfecha') !== null) |
||
| 71 | ? $this->request->request->get('filterstartfecha') |
||
| 72 | : $periodStartDate; |
||
| 73 | $endDate = ($this->request->request->get('filterendfecha') !== null) |
||
| 74 | ? $this->request->request->get('filterendfecha') |
||
| 75 | : $periodEndDate; |
||
| 76 | $year = substr($startDate, 6, 4); |
||
| 77 | $month = substr($startDate, 3, 2); |
||
| 78 | $commonFunctions = new CommonFunctionsDominicanRepublic(); |
||
| 79 | $option = $this->request->get('option'); |
||
| 80 | $actualTab = $this->request->get('activetab'); |
||
| 81 | switch ($actualTab) { |
||
| 82 | case "FiscalReport606": |
||
| 83 | $whereReport = [ |
||
| 84 | new DataBaseWhere('facturasprov.fecha', $startDate, '>='), |
||
| 85 | new DataBaseWhere('facturasprov.fecha', $endDate, '<='), |
||
| 86 | ]; |
||
| 87 | if ($action === 'export' and $option === 'dgii') { |
||
| 88 | $this->setTemplate(false); |
||
| 89 | $fileName = 'DGII_606_'.$this->empresa->cifnif.'_'.$year.'_'.$month.'.txt'; |
||
| 90 | $commonFunctions->exportTXT('606', $fileName, $this->empresa->cifnif, $year, $month, $whereReport); |
||
| 91 | $this->response->headers->set('Content-type', 'text/plain'); |
||
| 92 | $this->response->headers->set('Content-Disposition', 'attachment;filename=' . $fileName); |
||
| 93 | $this->response->setContent(file_get_contents(\FS_FOLDER . DIRECTORY_SEPARATOR . $fileName)); |
||
| 94 | } |
||
| 95 | break; |
||
| 96 | case "FiscalReport607": |
||
| 97 | $whereReport = [ |
||
| 98 | new DataBaseWhere('facturascli.fecha', $startDate, '>='), |
||
| 99 | new DataBaseWhere('facturascli.fecha', $endDate, '<='), |
||
| 100 | ]; |
||
| 101 | if ($action === 'export' and $option === 'dgii') { |
||
| 102 | $fileName = 'DGII_607_'.$this->empresa->cifnif.'_'.$year.'_'.$month.'.txt'; |
||
| 103 | $commonFunctions->exportTXT('607', $fileName, $this->empresa->cifnif, $year, $month, $whereReport); |
||
| 104 | $this->response->headers->set('Content-type', 'text/plain'); |
||
| 105 | $this->response->headers->set('Content-Disposition', 'attachment;filename=' . $fileName); |
||
| 106 | $this->response->setContent(file_get_contents(\FS_FOLDER . DIRECTORY_SEPARATOR . $fileName)); |
||
| 107 | $this->setTemplate(false); |
||
| 108 | } |
||
| 109 | break; |
||
| 110 | case "FiscalReport608": |
||
| 111 | $whereReport = [ |
||
| 112 | new DataBaseWhere('facturascli.fecha', $startDate, '>='), |
||
| 113 | new DataBaseWhere('facturascli.fecha', $endDate, '<='), |
||
| 114 | ]; |
||
| 115 | if ($action === 'export' and $option === 'dgii') { |
||
| 116 | $this->setTemplate(false); |
||
| 117 | $fileName = 'DGII_608_'.$this->empresa->cifnif.'_'.$year.'_'.$month.'.txt'; |
||
| 118 | $commonFunctions->exportTXT('608', $fileName, $this->empresa->cifnif, $year, $month, $whereReport); |
||
| 119 | $this->response->headers->set('Content-type', 'text/plain'); |
||
| 120 | $this->response->headers->set('Content-Disposition', 'attachment;filename=' . $fileName); |
||
| 121 | $this->response->setContent(file_get_contents(\FS_FOLDER . DIRECTORY_SEPARATOR . $fileName)); |
||
| 122 | } |
||
| 123 | break; |
||
| 124 | default: |
||
| 125 | $whereReport = [ |
||
| 126 | new DataBaseWhere('facturascli.fecha', $startDate, '>='), |
||
| 127 | new DataBaseWhere('facturascli.fecha', $endDate, '<='), |
||
| 128 | ]; |
||
| 129 | break; |
||
| 130 | } |
||
| 249 |
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