Passed
Push — master ( e40575...c62cbd )
by Joe Nilson
02:27
created

EditProveedor::createViews()   A

Complexity

Conditions 3
Paths 1

Size

Total Lines 14
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 10
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 14
rs 9.9332
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\NCFTipoPago;
0 ignored issues
show
Bug introduced by
The type FacturaScripts\Dinamic\Model\NCFTipoPago 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 EditProveedor
24
{
25
26
    public function createViews()
27
    {
28
        return function () {
29
30
            $ncfTipoPago = new NCFTipoPago();
31
            $ncfTiposPago = $ncfTipoPago->findAllByTipopago('02');
32
            $customValuesNTP = [];
33
            $customValuesNTP[] = ['value'=>'', 'title'=>'-----------'];
34
            foreach ($ncfTiposPago as $tipopago) {
35
                $customValuesNTP[] = ['value'=>$tipopago->codigo, 'title'=>$tipopago->descripcion];
36
            }
37
            $columnToModifyNTP = $this->views['EditProveedor']->columnForName('ncf-payment-types');
0 ignored issues
show
Bug Best Practice introduced by
The property views does not exist on FacturaScripts\Plugins\f...ontroller\EditProveedor. Did you maybe forget to declare it?
Loading history...
38
            if ($columnToModifyNTP) {
39
                $columnToModifyNTP->widget->setValuesFromArray($customValuesNTP);
40
            }
41
        };
42
    }
43
}
44