1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* File containing the ObjectStateGroup class. |
5
|
|
|
* |
6
|
|
|
* @copyright Copyright (C) eZ Systems AS. All rights reserved. |
7
|
|
|
* @license For full copyright and license information view LICENSE file distributed with this source code. |
8
|
|
|
*/ |
9
|
|
|
namespace eZ\Publish\Core\Repository\Values\ObjectState; |
10
|
|
|
|
11
|
|
|
use eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup as APIObjectStateGroup; |
12
|
|
|
use eZ\Publish\Core\Repository\Values\MultiLanguageDescriptionTrait; |
13
|
|
|
use eZ\Publish\Core\Repository\Values\MultiLanguageNameTrait; |
14
|
|
|
use eZ\Publish\Core\Repository\Values\MultiLanguageTrait; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* This class represents an object state group value. |
18
|
|
|
* |
19
|
|
|
* @property-read mixed $id the id of the content type group |
20
|
|
|
* @property-read string $identifier the identifier of the content type group |
21
|
|
|
* @property-read string $mainLanguageCode the default language of the object state group names and description used for fallback. |
22
|
|
|
* @property-read string $defaultLanguageCode deprecated, use $mainLanguageCode |
23
|
|
|
* @property-read string[] $languageCodes the available languages |
24
|
|
|
* |
25
|
|
|
* @internal Meant for internal use by Repository, type hint against API object instead. |
26
|
|
|
*/ |
27
|
|
View Code Duplication |
class ObjectStateGroup extends APIObjectStateGroup |
|
|
|
|
28
|
|
|
{ |
29
|
|
|
use MultiLanguageTrait; |
30
|
|
|
use MultiLanguageNameTrait; |
31
|
|
|
use MultiLanguageDescriptionTrait; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Magic getter for BC reasons. |
35
|
|
|
* |
36
|
|
|
* @param string $property |
37
|
|
|
* @return mixed |
38
|
|
|
*/ |
39
|
|
|
public function __get($property) |
40
|
|
|
{ |
41
|
|
|
if ($property === 'defaultLanguageCode') { |
42
|
|
|
@trigger_error( |
|
|
|
|
43
|
|
|
__CLASS__ . '::$defaultLanguageCode is deprecated. Use mainLanguageCode', |
44
|
|
|
E_USER_DEPRECATED |
45
|
|
|
); |
46
|
|
|
|
47
|
|
|
return $this->mainLanguageCode; |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
return parent::__get($property); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
public function __isset($property) |
54
|
|
|
{ |
55
|
|
|
if ($property === 'defaultLanguageCode') { |
56
|
|
|
@trigger_error( |
|
|
|
|
57
|
|
|
__CLASS__ . '::$defaultLanguageCode is deprecated. Use mainLanguageCode', |
58
|
|
|
E_USER_DEPRECATED |
59
|
|
|
); |
60
|
|
|
|
61
|
|
|
return true; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
return parent::__isset($property); |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.