[TASK] Re-work/simplify copyright header in PHP files - Part 9
[Packages/TYPO3.CMS.git] / typo3 / sysext / extensionmanager / Classes / Domain / Model / Repository.php
1 <?php
2 namespace TYPO3\CMS\Extensionmanager\Domain\Model;
3
4 /**
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16 /**
17 * Repository object for extension manager.
18 *
19 * @author Marcus Krause <marcus#exp2010@t3sec.info>
20 * @author Steffen Kamper <info@sk-typo3.de>
21 * @since 2010-02-11
22 */
23 class Repository extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
24
25 /**
26 * Keeps repository title.
27 *
28 * @var string
29 */
30 protected $title;
31
32 /**
33 * Keeps repository description.
34 *
35 * @var string
36 */
37 protected $description;
38
39 /**
40 * Keeps mirror list URL.
41 *
42 * @var string
43 */
44 protected $mirrorListUrl;
45
46 /**
47 * Keeps repository mirrors object.
48 *
49 * @var \TYPO3\CMS\Extensionmanager\Domain\Model\Mirrors
50 */
51 protected $mirrors;
52
53 /**
54 * Keeps wsdl URL.
55 *
56 * @var string
57 */
58 protected $wsdlUrl;
59
60 /**
61 * Keeps last update.
62 *
63 * @var \DateTime
64 */
65 protected $lastUpdate;
66
67 /**
68 * Keeps extension count.
69 *
70 * @var string
71 */
72 protected $extensionCount;
73
74 /**
75 * Method returns title of a repository.
76 *
77 * @access public
78 * @return string title of repository
79 * @see $title, setTitle()
80 */
81 public function getTitle() {
82 return $this->title;
83 }
84
85 /**
86 * Method sets title of a repository.
87 *
88 * @access public
89 * @param string $title title of repository to set
90 * @return void
91 * @see $title, getTitle()
92 */
93 public function setTitle($title) {
94 if (!empty($title) && is_string($title)) {
95 $this->title = $title;
96 }
97 }
98
99 /**
100 * Method returns description of a repository.
101 *
102 * @access public
103 * @return string title of repository
104 * @see $title, setTitle()
105 */
106 public function getDescription() {
107 return $this->description;
108 }
109
110 /**
111 * Method sets description of a repository.
112 *
113 * @access public
114 * @param string $description title of repository to set
115 * @return void
116 */
117 public function setDescription($description) {
118 if (!empty($description) && is_string($description)) {
119 $this->description = $description;
120 }
121 }
122
123 /**
124 * Method returns URL of a resource that contains repository mirrors.
125 *
126 * @access public
127 * @return string URL of file that contains repository mirrors
128 * @see $mirrorListUrl, getMirrorListUrl()
129 */
130 public function getMirrorListUrl() {
131 return $this->mirrorListUrl;
132 }
133
134 /**
135 * Method sets URL of a resource that contains repository mirrors.
136 *
137 * Parameter is typically a remote gzipped xml file.
138 *
139 * @access public
140 * @param string $url URL of file that contains repository mirrors
141 * @return void
142 * @see $mirrorListUrl, getMirrorListUrl()
143 */
144 public function setMirrorListUrl($url) {
145 if (empty($url) || !empty($url) && \TYPO3\CMS\Core\Utility\GeneralUtility::isValidUrl($url)) {
146 $this->mirrorListUrl = $url;
147 }
148 }
149
150 /**
151 * Method returns URL of repository WSDL.
152 *
153 * @access public
154 * @return string URL of repository WSDL
155 * @see $wsdlUrl, setWsdlUrl()
156 */
157 public function getWsdlUrl() {
158 return $this->wsdlUrl;
159 }
160
161 /**
162 * Method sets URL of repository WSDL.
163 *
164 * @param string $url URL of repository WSDL
165 * @return void
166 * @see $wsdlUrl, getWsdlUrl()
167 */
168 public function setWsdlUrl($url) {
169 if (!empty($url) && \TYPO3\CMS\Core\Utility\GeneralUtility::isValidUrl($url)) {
170 $this->wsdlUrl = $url;
171 }
172 }
173
174 /**
175 * Method returns LastUpdate.
176 *
177 * @access public
178 * @return \DateTime timestamp of last update
179 */
180 public function getLastUpdate() {
181 return $this->lastUpdate;
182 }
183
184 /**
185 * Method sets LastUpdate.
186 *
187 * @access public
188 * @param \DateTime $time URL of repository WSDL
189 * @return void
190 */
191 public function setLastUpdate(\DateTime $time) {
192 $this->lastUpdate = $time;
193 }
194
195 /**
196 * Method returns extension count
197 *
198 * @access public
199 * @return integer count of read extensions
200 */
201 public function getExtensionCount() {
202 return $this->extensionCount;
203 }
204
205 /**
206 * Method sets extension count
207 *
208 * @access public
209 * @param string $count count of read extensions
210 * @return void
211 */
212 public function setExtensionCount($count) {
213 $this->extensionCount = $count;
214 }
215
216 /**
217 * Method registers repository mirrors object.
218 *
219 * Repository mirrors object is passed by reference.
220 *
221 * @access public
222 * @param \TYPO3\CMS\Extensionmanager\Domain\Model\Mirrors $mirrors mirror list
223 * @return void
224 * @see $mirrors, getMirrors(), hasMirrors(), removeMirrors()
225 */
226 public function addMirrors(\TYPO3\CMS\Extensionmanager\Domain\Model\Mirrors $mirrors) {
227 $this->mirrors = $mirrors;
228 }
229
230 /**
231 * Method returns information if a repository mirrors
232 * object has been registered to this repository.
233 *
234 * @access public
235 * @return boolean TRUE, if a repository mirrors object has been registered, otherwise FALSE
236 * @see $mirrors, addMirrors(), getMirrors(), removeMirrors()
237 */
238 public function hasMirrors() {
239 $hasMirrors = FALSE;
240 if (is_object($this->mirrors)) {
241 $hasMirrors = TRUE;
242 }
243 return $hasMirrors;
244 }
245
246 /**
247 * Method returns a repository mirrors object.
248 *
249 * @access public
250 * @return \TYPO3\CMS\Extensionmanager\Domain\Model\Mirrors mirrors for repository
251 * @see $mirrors, addMirrors(), hasMirrors(), removeMirrors()
252 */
253 public function getMirrors() {
254 return $this->hasMirrors() ? $this->mirrors : NULL;
255 }
256
257 /**
258 * Method unregisters a repository mirrors object.
259 *
260 * @access public
261 * @return void
262 * @see $mirrors, addMirrors(), getMirrors(), hasMirrors()
263 */
264 public function removeMirrors() {
265 unset($this->mirrors);
266 }
267
268 }