-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathManualRedirect.php
140 lines (109 loc) · 2.38 KB
/
ManualRedirect.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<?php
namespace Statamic\Addons\Redirects;
class ManualRedirect
{
const DATE_TIME_FORMAT = 'Y-m-d H:i:s';
/**
* @var string
*/
private $from;
/**
* @var string
*/
private $to;
/**
* @var int
*/
private $statusCode = 301;
/**
* @var string
*/
private $locale;
/**
* @var bool
*/
private $retainQueryStrings = false;
/**
* @var \DateTime
*/
private $startDate;
/**
* @var \DateTime
*/
private $endDate;
public function getFrom()
{
return $this->from;
}
public function setFrom($from)
{
$this->from = $from;
return $this;
}
public function getTo()
{
return $this->to;
}
public function setTo($to)
{
$this->to = $to;
return $this;
}
public function getStatusCode()
{
return $this->statusCode;
}
public function setStatusCode($statusCode)
{
$this->statusCode = $statusCode;
return $this;
}
public function getStartDate()
{
return $this->startDate;
}
public function setStartDate($startDate)
{
$this->startDate = $startDate;
return $this;
}
public function getEndDate()
{
return $this->endDate;
}
public function setEndDate($endDate)
{
$this->endDate = $endDate;
return $this;
}
public function getLocale()
{
return $this->locale;
}
public function setLocale($locale)
{
$this->locale = $locale;
return $this;
}
public function isRetainQueryStrings()
{
return $this->retainQueryStrings;
}
public function setRetainQueryStrings($retainQueryStrings)
{
$this->retainQueryStrings = $retainQueryStrings;
return $this;
}
public function toArray()
{
return [
'from' => $this->from,
'to' => $this->to,
'status_code' => $this->statusCode,
'locale' => $this->locale,
'retain_query_strings' => $this->retainQueryStrings,
'start_date' => $this->startDate instanceof \DateTime ? $this->startDate->format(self::DATE_TIME_FORMAT) : null,
'end_date' => $this->endDate instanceof \DateTime ? $this->endDate->format(self::DATE_TIME_FORMAT) : null,
];
}
}