Passed
Push — master ( c738d5...5ab87e )
by payever
10:29
created

SubscriptionResponseEntity   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 83
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Importance

Changes 0
Metric Value
wmc 7
lcom 2
cbo 2
dl 0
loc 83
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getExternalId() 0 6 2
A setCreatedAt() 0 4 1
A setUpdatedAt() 0 4 1
A setActions() 0 8 2
A getRequired() 0 7 1
1
<?php
2
3
/**
4
 * PHP version 5.4 and 7
5
 *
6
 * @category  ResponseEntity
7
 * @package   Payever\ThirdParty
8
 * @author    payever GmbH <[email protected]>
9
 * @author    Hennadii.Shymanskyi <[email protected]>
10
 * @copyright 2017-2021 payever GmbH
11
 * @license   MIT <https://opensource.org/licenses/MIT>
12
 * @link      https://docs.payever.org/shopsystems/api/getting-started
13
 */
14
15
namespace Payever\ExternalIntegration\ThirdParty\Http\ResponseEntity;
16
17
use Payever\ExternalIntegration\Core\Http\ResponseEntity;
18
use Payever\ExternalIntegration\ThirdParty\Http\MessageEntity\SubscriptionActionEntity;
19
20
/**
21
 * @method string getId()
22
 * @method string getAuthorizationId()
23
 * @method string getIntegration()
24
 * @method bool getConnected()
25
 * @method \DateTime|false getCreatedAt()
26
 * @method \DateTime|false getUpdatedAt()
27
 * @method SubscriptionActionEntity[] getActions()
28
 */
29
class SubscriptionResponseEntity extends ResponseEntity
30
{
31
    /**
32
     * @deprecated use $authorizationId instead
33
     *
34
     * @var string
35
     */
36
    protected $externalId;
37
38
    /**
39
     * Field value must be saved by user for further use in sync-related requests
40
     *
41
     * @var string
42
     */
43
    protected $authorizationId;
44
45
    /** @var string */
46
    protected $integration;
47
48
    /** @var bool */
49
    protected $connected;
50
51
    /** @var \DateTime|bool */
52
    protected $createdAt;
53
54
    /** @var \DateTime|bool */
55
    protected $updatedAt;
56
57
    /** @var SubscriptionActionEntity[] */
58
    protected $actions;
59
60
    /**
61
     * @deprecated use getAuthorizationId() instead
62
     *
63
     * @return string
64
     */
65
    public function getExternalId()
66
    {
67
        return null === $this->externalId
0 ignored issues
show
Deprecated Code introduced by
The property Payever\ExternalIntegrat...onseEntity::$externalId has been deprecated with message: use $authorizationId instead

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
68
            ? $this->authorizationId
69
            : $this->externalId;
0 ignored issues
show
Deprecated Code introduced by
The property Payever\ExternalIntegrat...onseEntity::$externalId has been deprecated with message: use $authorizationId instead

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
70
    }
71
72
    /**
73
     * @param string $createdAt
74
     */
75
    public function setCreatedAt($createdAt)
76
    {
77
        $this->createdAt = date_create($createdAt);
78
    }
79
80
    /**
81
     * @param string $updatedAt
82
     */
83
    public function setUpdatedAt($updatedAt)
84
    {
85
        $this->updatedAt = date_create($updatedAt);
86
    }
87
88
    /**
89
     * @param array $actions
90
     * @return static
91
     */
92
    public function setActions($actions)
93
    {
94
        foreach ($actions as $plainAction) {
95
            $this->actions[] = new SubscriptionActionEntity($plainAction);
96
        }
97
98
        return $this;
99
    }
100
101
    /**
102
     * @return array
103
     */
104
    public function getRequired()
105
    {
106
        return [
107
            'authorizationId',
108
            'connected',
109
        ];
110
    }
111
}
112