Passed
Push — master ( 8a423f...9c95d4 )
by Joe Nilson
01:52
created

EditCliente::createViews()   A

Complexity

Conditions 3
Paths 1

Size

Total Lines 13
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 3
eloc 10
nc 1
nop 0
dl 0
loc 13
rs 9.9332
c 1
b 0
f 1
1
<?php
2
/**
3
 * Copyright (C) 2020 Joe Nilson <joenilson at gmail dot com>
4
 * 
5
 * fsRepublicaDominicana is free software: you can redistribute it and/or modify
6
 * it under the terms of the GNU Lesser General Public License as published by
7
 * the Free Software Foundation, either version 3 of the License, or
8
 * (at your option) any later version.
9
 * 
10
 * fsRepublicaDominicana is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU Lesser General Public License for more details.
14
 * 
15
 * You should have received a copy of the GNU Lesser General Public License
16
 * along with fsRepublicaDominicana. If not, see <http://www.gnu.org/licenses/>.
17
 */
18
19
namespace FacturaScripts\Plugins\fsRepublicaDominicana\Extension\Controller;
20
21
use FacturaScripts\Dinamic\Model\NCFTipo;
0 ignored issues
show
Bug introduced by
The type FacturaScripts\Dinamic\Model\NCFTipo was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
22
23
class EditCliente
24
{
25
26
    public function createViews()
27
    {
28
        return function () {
29
            $ncfTipo = new NCFTipo();
30
            $tipoComprobantes = $ncfTipo->allFor('ventas', 'suma');
31
            $customValues = [];
32
            $customValues[] = ['value'=>'', 'title'=>'-----------'];
33
            foreach($tipoComprobantes as $tipo) {
34
                $customValues[] = ['value'=>$tipo->tipocomprobante, 'title'=>$tipo->descripcion];
35
            }
36
            $columnToModify = $this->views['EditCliente']->columnForName('codsubtipodoc');
0 ignored issues
show
Bug Best Practice introduced by
The property views does not exist on FacturaScripts\Plugins\f...\Controller\EditCliente. Did you maybe forget to declare it?
Loading history...
37
            if($columnToModify) {
38
                $columnToModify->widget->setValuesFromArray($customValues);
39
            }
40
        };
41
    }
42
}
43