[TASK] Cleanup and update language module
[Packages/TYPO3.CMS.git] / typo3 / sysext / lang / Classes / Domain / Model / Extension.php
1 <?php
2 namespace TYPO3\CMS\Lang\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 /**
18 * Extension model
19 *
20 * @author Sebastian Fischer <typo3@evoweb.de>
21 * @author Kai Vogel <k.vogel@reply.de>
22 */
23 class Extension extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
24
25 /**
26 * @var string
27 */
28 protected $key = '';
29
30 /**
31 * @var string
32 */
33 protected $title = '';
34
35 /**
36 * @var string
37 */
38 protected $icon = '';
39
40 /**
41 * @var int
42 */
43 protected $version = '';
44
45 /**
46 * @var array
47 */
48 protected $updateResult = array();
49
50 /**
51 * Constructor of the extension model.
52 *
53 * @param string $key The extension key
54 * @param string $title Title of the extension
55 * @param string $icon Icon representing the extension
56 */
57 public function __construct($key = '', $title= '', $icon = '') {
58 $this->setKey($key);
59 $this->setTitle($title);
60 $this->setIcon($icon);
61 }
62
63 /**
64 * Setter for the icon
65 *
66 * @param string $icon ext_icon path relative to typo3 folder like ../typo3conf/ext/extensionkey/ext_icon.gif
67 * @return void
68 */
69 public function setIcon($icon) {
70 $this->icon = $icon;
71 }
72
73 /**
74 * Getter for the icon
75 *
76 * @return string ext_icon path relative to typo3 folder
77 */
78 public function getIcon() {
79 return $this->icon;
80 }
81
82 /**
83 * Setter for the key
84 *
85 * @param string $key
86 * @return void
87 */
88 public function setKey($key) {
89 $this->key = $key;
90 }
91
92 /**
93 * Getter for the key
94 *
95 * @return string
96 */
97 public function getKey() {
98 return $this->key;
99 }
100
101 /**
102 * Setter for the title
103 *
104 * @param string $title
105 * @return void
106 */
107 public function setTitle($title) {
108 $this->title = $title;
109 }
110
111 /**
112 * Getter for the title
113 *
114 * @return string
115 */
116 public function getTitle() {
117 return $this->title;
118 }
119
120 /**
121 * Setter for the version
122 *
123 * @param int $version Needs to have a valid version format like 1003007
124 * @return void
125 */
126 public function setVersion($version) {
127 $this->version = $version;
128 }
129
130 /**
131 * Setter for the version from string
132 *
133 * @param string $version Needs to have a format like '1.3.7' and converts it into an integer like 1003007 before setting the version
134 * @see \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger
135 * @return void
136 */
137 public function setVersionFromString($version) {
138 $this->version = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger($version);
139 }
140
141 /**
142 * Getter for the version
143 *
144 * @return int interpretation of the extension version
145 */
146 public function getVersion() {
147 return $this->version;
148 }
149
150 /**
151 * Setter for updateResult
152 *
153 * @param array $updateResult Needs to be in a structure like array('icon' => '', 'message' => '')
154 * @return void
155 */
156 public function setUpdateResult($updateResult) {
157 $this->updateResult = (array)$updateResult;
158 }
159
160 /**
161 * Getter for updateResult
162 *
163 * @return array returns the update result as an array in the structure like array('icon' => '', 'message' => '')
164 */
165 public function getUpdateResult() {
166 return $this->updateResult;
167 }
168
169 /**
170 * Returns an array represetation of current model
171 *
172 * @return array The properties
173 */
174 public function toArray() {
175 return array(
176 'key' => $this->getKey(),
177 'title' => $this->getTitle(),
178 'icon' => $this->getIcon(),
179 'version' => $this->getVersion(),
180 );
181 }
182
183 }