Passed
Push — master ( b1e93f...10cd5c )
by Jhao
02:12
created

TrackingOperationParameters   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
dl 0
loc 45
ccs 6
cts 6
cp 1
rs 10
c 1
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getAttribute() 0 3 1
A getOperation() 0 3 1
A getPerformedAt() 0 5 1
1
<?php
2
3
/**
4
 * This file is part of RussianPost SDK package.
5
 *
6
 * © Appwilio (http://appwilio.com), greabock (https://github.com/greabock), JhaoDa (https://github.com/jhaoda)
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Appwilio\RussianPostSDK\Tracking\Single;
15
16
class TrackingOperationParameters
17
{
18
    /** @var Parameter */
19
    private $OperType;
20
21
    /** @var Parameter */
22
    private $OperAttr;
23
24
    /** @var string */
25
    private $OperDate;
26
27
    /**
28
     * Информация об операции (OperType).
29
     *
30
     * @link https://tracking.pochta.ru/support/dictionaries/operation_codes
31
     *
32
     * @return Parameter
33
     */
34 1
    public function getOperation(): Parameter
35
    {
36 1
        return $this->OperType;
37
    }
38
39
    /**
40
     * Атрибут операции (OperAttr).
41
     *
42
     * @link https://tracking.pochta.ru/support/dictionaries/operation_codes
43
     *
44
     * @return Parameter
45
     */
46 1
    public function getAttribute(): Parameter
47
    {
48 1
        return $this->OperAttr;
49
    }
50
51
    /**
52
     * Время проведения операции (OperDate).
53
     *
54
     * @return \DateTimeImmutable
55
     */
56 1
    public function getPerformedAt(): \DateTimeImmutable
57
    {
58
        // Использовать \DATE_RFC3339_EXTENDED можно только в PHP 7.3+
59
        // @see https://bugs.php.net/bug.php?id=76009
60 1
        return \DateTimeImmutable::createFromFormat('Y-m-d\TH:i:s.???P', $this->OperDate);
61
    }
62
}
63