Completed
Push — master ( a5e931...d15f5b )
by Gilmar
28:45 queued 03:51
created

Invoice::getShipDate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
/*
4
 * This file is part of gpupo/netshoes-sdk
5
 * Created by Gilmar Pupo <[email protected]>
6
 * For the information of copyright and license you should read the file
7
 * LICENSE which is distributed with this source code.
8
 * Para a informação dos direitos autorais e de licença você deve ler o arquivo
9
 * LICENSE que é distribuído com este código-fonte.
10
 * Para obtener la información de los derechos de autor y la licencia debe leer
11
 * el archivo LICENSE que se distribuye con el código fuente.
12
 * For more information, see <http://www.g1mr.com/>.
13
 */
14
15
namespace Gpupo\NetshoesSdk\Entity\Order\Shippings;
16
17
use Gpupo\CommonSdk\Entity\EntityAbstract;
18
use Gpupo\CommonSdk\Entity\EntityInterface;
19
use Gpupo\NetshoesSdk\Traits\DateTimeTrait;
20
21
/**
22
 * @method string getNumber()    Acesso a number
23
 * @method setNumber(string $number)    Define number
24
 * @method int getLine()    Acesso a line
25
 * @method setLine(integer $line)    Define line
26
 * @method string getAccessKey()    Acesso a accessKey
27
 * @method setAccessKey(string $accessKey)    Define accessKey
28
 * @method setShipDate(string $shipDate)    Define shipDate
29
 * @method string getUrl()    Acesso a url
30
 * @method setUrl(string $url)    Define url
31
 */
32
class Invoice extends EntityAbstract implements EntityInterface
33
{
34
    use DateTimeTrait;
35
36
    protected $primaryKey = 'number';
37
38
    /**
39
     * @codeCoverageIgnore
40
     */
41
    public function getSchema()
42
    {
43
        return [
44
            'number'    => 'string',
45
            'line'      => 'integer',
46
            'accessKey' => 'string',
47
            'issueDate' => 'datetime',
48
            'shipDate'  => 'datetime',
49
            'url'       => 'string',
50
        ];
51
    }
52
53
    /**
54
     * {@inheritdoc}
55
     */
56 8
    protected function beforeConstruct($data = null)
57
    {
58 8
        if (is_array($data) && array_key_exists('date', $data)) {
59 1
            $data['issueDate'] = $data['date'];
60
        }
61
62 8
        return $data;
63
    }
64
65 4
    public function check()
66
    {
67 4
        $this->setRequiredSchema(['number', 'line', 'accessKey', 'issueDate']);
68 4
        $this->setOptionalSchema(['shipDate', 'url']);
69
70 4
        return $this->isValid();
71
    }
72
73 3
    public function getIssueDate()
74
    {
75 3
        return $this->dateGet('issueDate');
76
    }
77
78 2
    public function getShipDate()
79
    {
80 2
        return $this->dateGet('shipDate');
81
    }
82
}
83