1 | <?php |
||
13 | class MonolingualTextValue extends DataValueObject { |
||
14 | |||
15 | /** |
||
16 | * @var string |
||
17 | */ |
||
18 | private $languageCode; |
||
19 | |||
20 | /** |
||
21 | * @var string |
||
22 | */ |
||
23 | private $text; |
||
24 | |||
25 | /** |
||
26 | * @param string $languageCode |
||
27 | * @param string $text |
||
28 | * |
||
29 | * @throws IllegalValueException |
||
30 | */ |
||
31 | 18 | public function __construct( $languageCode, $text ) { |
|
42 | |||
43 | /** |
||
44 | * @see Serializable::serialize |
||
45 | * |
||
46 | * @return string |
||
47 | */ |
||
48 | 6 | public function serialize() { |
|
51 | |||
52 | /** |
||
53 | * @see Serializable::unserialize |
||
54 | * |
||
55 | * @param string $value |
||
56 | */ |
||
57 | 6 | public function unserialize( $value ) { |
|
61 | |||
62 | /** |
||
63 | * @see DataValue::getType |
||
64 | * |
||
65 | * @return string |
||
66 | */ |
||
67 | 4 | public static function getType() { |
|
70 | |||
71 | /** |
||
72 | * @see DataValue::getSortKey |
||
73 | * |
||
74 | * @return string |
||
75 | */ |
||
76 | public function getSortKey() { |
||
80 | |||
81 | /** |
||
82 | * @see DataValue::getValue |
||
83 | * |
||
84 | * @return self |
||
85 | */ |
||
86 | 2 | public function getValue() { |
|
89 | |||
90 | /** |
||
91 | * @return string |
||
92 | */ |
||
93 | 2 | public function getText() { |
|
96 | |||
97 | /** |
||
98 | * @return string |
||
99 | */ |
||
100 | 2 | public function getLanguageCode() { |
|
103 | |||
104 | /** |
||
105 | * @see DataValue::getArrayValue |
||
106 | * |
||
107 | * @return string[] |
||
108 | */ |
||
109 | 4 | public function getArrayValue() { |
|
115 | |||
116 | /** |
||
117 | * Constructs a new instance from the provided data. Required for @see DataValueDeserializer. |
||
118 | * This is expected to round-trip with @see getArrayValue. |
||
119 | * |
||
120 | * @deprecated since 0.3.2. Static DataValue::newFromArray constructors like this are |
||
121 | * underspecified (not in the DataValue interface), and misleadingly named (should be named |
||
122 | * newFromArrayValue). Instead, use DataValue builder callbacks in @see DataValueDeserializer. |
||
123 | * |
||
124 | * @param mixed $data Warning! Even if this is expected to be a value as returned by |
||
125 | * @see getArrayValue, callers of this specific newFromArray implementation can not guarantee |
||
126 | * this. This is not even guaranteed to be an array! |
||
127 | * |
||
128 | * @throws IllegalValueException if $data is not in the expected format. Subclasses of |
||
129 | * InvalidArgumentException are expected and properly handled by @see DataValueDeserializer. |
||
130 | * @return self |
||
131 | */ |
||
132 | public static function newFromArray( $data ) { |
||
137 | |||
138 | } |
||
139 |