[TASK] EXT:lang CodeCleanup
[Packages/TYPO3.CMS.git] / typo3 / sysext / lang / Classes / Domain / Model / Language.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 use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
18
19 /**
20 * Language model
21 */
22 class Language extends AbstractEntity
23 {
24 /**
25 * @var string
26 */
27 protected $locale = '';
28
29 /**
30 * @var string
31 */
32 protected $label = '';
33
34 /**
35 * @var bool
36 */
37 protected $selected = false;
38
39 /**
40 * @var int
41 */
42 protected $lastUpdate;
43
44 /**
45 * Constructor of the language model
46 *
47 * @param string $locale
48 * @param string $label
49 * @param bool $selected
50 * @param int $lastUpdate
51 */
52 public function __construct($locale = '', $label = '', $selected = false, $lastUpdate = null)
53 {
54 $this->locale = $locale;
55 $this->label = $label;
56 $this->selected = $selected;
57 $this->lastUpdate = $lastUpdate;
58 }
59
60 /**
61 * @return int
62 */
63 public function getLastUpdate()
64 {
65 return $this->lastUpdate;
66 }
67
68 /**
69 * @param int $lastUpdate
70 */
71 public function setLastUpdate($lastUpdate)
72 {
73 $this->lastUpdate = $lastUpdate;
74 }
75
76 /**
77 * Setter for the language
78 *
79 * @param string $language the label of the language
80 * @return void
81 */
82 public function setLabel($language)
83 {
84 $this->label = $language;
85 }
86
87 /**
88 * Getter for the language
89 *
90 * @return string
91 */
92 public function getLabel()
93 {
94 return $this->label;
95 }
96
97 /**
98 * Setter for the locale
99 *
100 * @param string $locale the locale for the language like da, nl or de
101 * @return void
102 */
103 public function setLocale($locale)
104 {
105 $this->locale = $locale;
106 }
107
108 /**
109 * Getter for the locale
110 *
111 * @return string
112 */
113 public function getLocale()
114 {
115 return $this->locale;
116 }
117
118 /**
119 * Setter for the selected
120 *
121 * @param bool $selected whether the language is available or not
122 * @return void
123 */
124 public function setSelected($selected)
125 {
126 $this->selected = (bool)$selected;
127 }
128
129 /**
130 * Getter for the selected
131 *
132 * @return bool
133 */
134 public function getSelected()
135 {
136 return $this->selected;
137 }
138
139 /**
140 * Returns an array represetation of current model
141 *
142 * @return array The properties
143 */
144 public function toArray()
145 {
146 return array(
147 'locale' => $this->getLocale(),
148 'label' => $this->getLabel(),
149 'selected' => $this->getSelected(),
150 'lastUpdate' => $this->getLastUpdate(),
151 );
152 }
153 }