Passed
Push — master ( ff32ae...adf353 )
by Luiz Kim
01:30
created

NFeService::createNfe()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 19
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 13
c 1
b 0
f 0
nc 4
nop 3
dl 0
loc 19
rs 9.8333
1
<?php
2
3
namespace ControleOnline\Service;
4
5
use ControleOnline\Entity\Order;
0 ignored issues
show
Bug introduced by
The type ControleOnline\Entity\Order 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...
6
use ControleOnline\Library\NFePHP;
7
8
class NFeService extends NFePHP
9
{
10
    public function createNfe(Order $order, $model, $version =  '4.0')
11
    {
12
13
        $this->model = $model;
14
        $this->version = $version;
15
        try {
16
            switch ($this->model) {
17
                case '65':
18
                    $this->cupomFiscal($order);
19
                    break;
20
                default:
21
                    return;
22
                    break;
0 ignored issues
show
Unused Code introduced by
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
23
            }
24
25
            return $this->assign($order);
26
27
        } catch (\Exception $e) {
28
            echo $e->getMessage();
29
        }
30
    }
31
32
    protected function cupomFiscal(Order $order)
33
    {
34
        $this->makeInfRespTec();
35
        $this->makeInfNFe($this->version);
36
        $this->makeIde($order);
37
        $this->makeEmit($order);
38
        $this->makeDest($order);
39
        $this->makeProds($order);
40
        $this->makeTransp($order);
41
        $this->makePag($order);
42
        $this->makedetPag($order);
43
    }
44
}
45