1 | <?php |
||
8 | abstract class Redirect |
||
9 | { |
||
10 | /** |
||
11 | * @var string |
||
12 | */ |
||
13 | protected $source; |
||
14 | |||
15 | /** |
||
16 | * @var string |
||
17 | */ |
||
18 | protected $destination; |
||
19 | |||
20 | /** |
||
21 | * @var bool |
||
22 | */ |
||
23 | protected $permanent; |
||
24 | |||
25 | /** |
||
26 | * @var int |
||
27 | */ |
||
28 | protected $count = 0; |
||
29 | |||
30 | /** |
||
31 | * @var \DateTime |
||
32 | */ |
||
33 | protected $lastAccessed = null; |
||
34 | |||
35 | /** |
||
36 | * @param string $source |
||
37 | * @param string $destination |
||
38 | * @param bool $permanent |
||
39 | */ |
||
40 | 36 | public function __construct($source, $destination, $permanent = true) |
|
46 | |||
47 | /** |
||
48 | * @param string $destination |
||
49 | * @param bool $permanent |
||
50 | * |
||
51 | * @return static |
||
52 | */ |
||
53 | 1 | public static function createFromNotFound(NotFound $notFound, $destination, $permanent = true) |
|
57 | |||
58 | /** |
||
59 | * @return string |
||
60 | */ |
||
61 | 24 | public function getSource() |
|
65 | |||
66 | /** |
||
67 | * @param string $source |
||
68 | */ |
||
69 | 36 | public function setSource($source) |
|
80 | |||
81 | /** |
||
82 | * @return string |
||
83 | */ |
||
84 | 13 | public function getDestination() |
|
88 | |||
89 | /** |
||
90 | * @param string $destination |
||
91 | */ |
||
92 | 36 | public function setDestination($destination) |
|
103 | |||
104 | /** |
||
105 | * @return bool |
||
106 | */ |
||
107 | 3 | public function isPermanent() |
|
111 | |||
112 | /** |
||
113 | * @param bool $permanent |
||
114 | */ |
||
115 | 36 | public function setPermanent($permanent) |
|
119 | |||
120 | /** |
||
121 | * @return int |
||
122 | */ |
||
123 | 4 | public function getCount() |
|
127 | |||
128 | /** |
||
129 | * @param int $amount |
||
130 | */ |
||
131 | 4 | public function increaseCount($amount = 1) |
|
135 | |||
136 | /** |
||
137 | * @return \DateTime |
||
138 | */ |
||
139 | 2 | public function getLastAccessed() |
|
143 | |||
144 | /** |
||
145 | * @param \DateTime $time |
||
146 | */ |
||
147 | 4 | public function updateLastAccessed(\DateTime $time = null) |
|
155 | |||
156 | /** |
||
157 | * @param string $path |
||
158 | * @param bool $allowQueryString |
||
159 | * |
||
160 | * @return string |
||
161 | */ |
||
162 | 36 | protected function createAbsoluteUri($path, $allowQueryString = false) |
|
172 | } |
||
173 |