Issues (17)

src/Received/Partial/Footer.php (1 issue)

Labels
Severity
1
<?php
2
namespace MrPrompt\Celesc\Received\Partial;
3
4
use MrPrompt\ShipmentCommon\Base\Parcel;
5
use MrPrompt\ShipmentCommon\Base\Sequence;
6
7
/**
8
 * File footer
9
 *
10
 * @author Thiago Paes <[email protected]>
11
 */
12
class Footer
13
{
14
    /**
15
     * Type of register
16
     *
17
     * @var string
18
     */
19
    const TYPE = '9';
20
21
    /**
22
     * @var Sequence
23
     */
24
    private $sequence;
25
26
    /**
27
     * @var Parcel
28
     */
29
    private $parcel;
30
31
    /**
32
     * Constructor
33
     * @param string $row
34
     */
35 3
    public function __construct($row)
36
    {
37 3
        $this->parcel = new Parcel();
38 3
        $this->parcel->setPrice(substr($row, 1, 11));
0 ignored issues
show
substr($row, 1, 11) of type string is incompatible with the type double expected by parameter $price of MrPrompt\ShipmentCommon\Base\Parcel::setPrice(). ( Ignorable by Annotation )

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

38
        $this->parcel->setPrice(/** @scrutinizer ignore-type */ substr($row, 1, 11));
Loading history...
39 3
        $this->parcel->setQuantity(1);
40
41 3
        $this->sequence = new Sequence((int) (substr($row, 144, 6)));
42 3
    }
43
44
    /**
45
     * @return Sequence
46
     */
47 1
    public function getSequence()
48
    {
49 1
        return $this->sequence;
50
    }
51
52
    /**
53
     * @param Sequence $sequence
54
     */
55 1
    public function setSequence(Sequence $sequence)
56
    {
57 1
        $this->sequence = $sequence;
58 1
    }
59
60
    /**
61
     * @return Parcel
62
     */
63
    public function getParcel()
64
    {
65
        return $this->parcel;
66
    }
67
68
    /**
69
     * @param Parcel $parcel
70
     */
71
    public function setParcel($parcel)
72
    {
73
        $this->parcel = $parcel;
74
    }
75
}
76