Passed
Push — master ( adf353...32c19c )
by Luiz Kim
01:27
created

NFeService::cte()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 0
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 2
rs 10
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
                case '55':
21
                    $this->nfe($order);
22
                    break;
23
                case '57':
24
                    $this->cte($order);
25
                    break;
26
                default:
27
                    return;
28
                    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...
29
            }
30
31
            return $this->sign($order);
32
        } catch (\Exception $e) {
33
            echo $e->getMessage();
34
        }
35
    }
36
37
    protected function nfe(Order $order)
0 ignored issues
show
Unused Code introduced by
The parameter $order is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

37
    protected function nfe(/** @scrutinizer ignore-unused */ Order $order)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
38
    {
39
    }
40
41
    protected function cte(Order $order)
0 ignored issues
show
Unused Code introduced by
The parameter $order is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

41
    protected function cte(/** @scrutinizer ignore-unused */ Order $order)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
42
    {
43
    }
44
45
    protected function cupomFiscal(Order $order)
46
    {
47
        $this->makeInfRespTec();
48
        $this->makeInfNFe($this->version);
49
        $this->makeIde($order);
50
        $this->makeEmit($order);
51
        $this->makeDest($order);
52
        $this->makeProds($order);
53
        $this->makeTransp($order);
54
        $this->makePag($order);
55
        $this->makedetPag($order);
56
    }
57
}
58