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