|
1
|
|
|
<?php |
|
2
|
|
|
declare(strict_types=1); |
|
3
|
|
|
|
|
4
|
|
|
namespace TogglJira\Options; |
|
5
|
|
|
|
|
6
|
|
|
use Zend\Stdlib\AbstractOptions; |
|
7
|
|
|
|
|
8
|
|
|
class SyncOptions extends AbstractOptions |
|
9
|
|
|
{ |
|
10
|
|
|
/** |
|
11
|
|
|
* @var string |
|
12
|
|
|
*/ |
|
13
|
|
|
private $jiraAccountId; |
|
14
|
|
|
/** |
|
15
|
|
|
* @var string |
|
16
|
|
|
*/ |
|
17
|
|
|
private $jiraApiKey; |
|
18
|
|
|
/** |
|
19
|
|
|
* @var string |
|
20
|
|
|
*/ |
|
21
|
|
|
private $jiraEmail; |
|
22
|
|
|
/** |
|
23
|
|
|
* @var string |
|
24
|
|
|
*/ |
|
25
|
|
|
private $jiraUrl; |
|
26
|
|
|
/** |
|
27
|
|
|
* @var \DateTimeInterface |
|
28
|
|
|
*/ |
|
29
|
|
|
private $lastSync; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* @var string |
|
33
|
|
|
*/ |
|
34
|
|
|
private $togglApiKey; |
|
35
|
|
|
|
|
36
|
|
|
public function __construct($options = null) |
|
37
|
|
|
{ |
|
38
|
|
|
$this->lastSync = new \DateTimeImmutable('-1 day'); |
|
39
|
|
|
|
|
40
|
|
|
parent::__construct($options); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @return string |
|
45
|
|
|
*/ |
|
46
|
|
|
public function getTogglApiKey(): string |
|
47
|
|
|
{ |
|
48
|
|
|
return $this->togglApiKey; |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* @param string $togglApiKey |
|
53
|
|
|
*/ |
|
54
|
|
|
public function setTogglApiKey(string $togglApiKey): void |
|
55
|
|
|
{ |
|
56
|
|
|
$this->togglApiKey = $togglApiKey; |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
3 |
|
/** |
|
60
|
|
|
* @return string |
|
61
|
3 |
|
*/ |
|
62
|
|
|
public function getjiraApiKey(): string |
|
63
|
3 |
|
{ |
|
64
|
3 |
|
return $this->jiraApiKey; |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* @param string $jiraApiKey |
|
69
|
2 |
|
*/ |
|
70
|
|
|
public function setjiraApiKey(string $jiraApiKey): void |
|
71
|
2 |
|
{ |
|
72
|
|
|
$this->jiraApiKey = $jiraApiKey; |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
public function getjiraAccountId(): string |
|
76
|
|
|
{ |
|
77
|
3 |
|
return $this->jiraAccountId; |
|
78
|
|
|
} |
|
79
|
3 |
|
|
|
80
|
3 |
|
/** |
|
81
|
|
|
* @param string $jiraAccountId |
|
82
|
|
|
*/ |
|
83
|
|
|
public function setjiraAccountId(string $jiraAccountId): void |
|
84
|
|
|
{ |
|
85
|
2 |
|
$this->jiraAccountId = $jiraAccountId; |
|
86
|
|
|
} |
|
87
|
2 |
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* @return \DateTimeInterface |
|
90
|
|
|
*/ |
|
91
|
|
|
public function getLastSync(): \DateTimeInterface |
|
92
|
|
|
{ |
|
93
|
3 |
|
return $this->lastSync; |
|
94
|
|
|
} |
|
95
|
3 |
|
|
|
96
|
3 |
|
/** |
|
97
|
|
|
* @param \DateTimeInterface $lastSync |
|
98
|
|
|
*/ |
|
99
|
|
|
public function setLastSync(\DateTimeInterface $lastSync): void |
|
100
|
|
|
{ |
|
101
|
2 |
|
$this->lastSync = $lastSync; |
|
102
|
|
|
} |
|
103
|
2 |
|
|
|
104
|
|
|
/** |
|
105
|
|
|
* @return string |
|
106
|
|
|
*/ |
|
107
|
|
|
public function getJiraUrl(): string |
|
108
|
|
|
{ |
|
109
|
3 |
|
return $this->jiraUrl; |
|
110
|
|
|
} |
|
111
|
3 |
|
|
|
112
|
3 |
|
/** |
|
113
|
|
|
* @param string $jiraUrl |
|
114
|
|
|
*/ |
|
115
|
|
|
public function setJiraUrl(string $jiraUrl): void |
|
116
|
|
|
{ |
|
117
|
|
|
$this->jiraUrl = $jiraUrl; |
|
118
|
2 |
|
} |
|
119
|
|
|
|
|
120
|
2 |
|
|
|
121
|
|
|
public function getjiraEmail(): string |
|
122
|
|
|
{ |
|
123
|
|
|
return $this->jiraEmail; |
|
124
|
|
|
} |
|
125
|
|
|
|
|
126
|
2 |
|
/** |
|
127
|
|
|
* @param string $jiraEmail |
|
128
|
2 |
|
*/ |
|
129
|
2 |
|
public function setJiraEmail(string $jiraEmail): void |
|
130
|
|
|
{ |
|
131
|
|
|
$this->jiraEmail = $jiraEmail; |
|
132
|
|
|
} |
|
133
|
|
|
|
|
134
|
2 |
|
/** |
|
135
|
|
|
* @return array |
|
136
|
2 |
|
*/ |
|
137
|
|
|
public function toArray(): array |
|
138
|
|
|
{ |
|
139
|
|
|
return [ |
|
140
|
|
|
'lastSync' => $this->getLastSync(), |
|
141
|
|
|
'jiraUrl' => $this->getJiraUrl(), |
|
142
|
3 |
|
'jiraEmail' => $this->getjiraEmail(), |
|
143
|
|
|
'jiraAccountId' => $this->getjiraAccountId(), |
|
144
|
3 |
|
'jiraApiKey' => $this->getjiraApiKey(), |
|
145
|
3 |
|
'togglApiKey' => $this->getTogglApiKey(), |
|
146
|
|
|
]; |
|
147
|
|
|
} |
|
148
|
|
|
} |
|
149
|
|
|
|