1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* File containing the ObjectState 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\ObjectState as APIObjectState; |
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 a object state 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 int $priority the priority in the group ordering |
22
|
|
|
* @property-read string $mainLanguageCode the default language of the object state names and descriptions used for fallback. |
23
|
|
|
* @property-read string $defaultLanguageCode deprecated, use $mainLanguageCode |
24
|
|
|
* @property-read string[] $languageCodes the available languages |
25
|
|
|
* |
26
|
|
|
* @internal Meant for internal use by Repository, type hint against API object instead. |
27
|
|
|
*/ |
28
|
|
View Code Duplication |
class ObjectState extends APIObjectState |
|
|
|
|
29
|
|
|
{ |
30
|
|
|
use MultiLanguageTrait; |
31
|
|
|
use MultiLanguageNameTrait; |
32
|
|
|
use MultiLanguageDescriptionTrait; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @var \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup |
36
|
|
|
*/ |
37
|
|
|
protected $objectStateGroup; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* The object state group this object state belongs to. |
41
|
|
|
* |
42
|
|
|
* @return \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup |
43
|
|
|
*/ |
44
|
|
|
public function getObjectStateGroup() |
45
|
|
|
{ |
46
|
|
|
return $this->objectStateGroup; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Magic getter for BC reasons. |
51
|
|
|
* |
52
|
|
|
* @param string $property |
53
|
|
|
* @return mixed |
54
|
|
|
*/ |
55
|
|
|
public function __get($property) |
56
|
|
|
{ |
57
|
|
|
if ($property === 'defaultLanguageCode') { |
58
|
|
|
@trigger_error( |
|
|
|
|
59
|
|
|
__CLASS__ . '::$defaultLanguageCode is deprecated. Use mainLanguageCode', |
60
|
|
|
E_USER_DEPRECATED |
61
|
|
|
); |
62
|
|
|
|
63
|
|
|
return $this->mainLanguageCode; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
return parent::__get($property); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* Magic isset for BC reasons. |
71
|
|
|
* |
72
|
|
|
* @param string $property |
73
|
|
|
* @return bool |
74
|
|
|
*/ |
75
|
|
|
public function __isset($property) |
76
|
|
|
{ |
77
|
|
|
if ($property === 'defaultLanguageCode') { |
78
|
|
|
@trigger_error( |
|
|
|
|
79
|
|
|
__CLASS__ . '::$defaultLanguageCode is deprecated. Use mainLanguageCode' |
80
|
|
|
); |
81
|
|
|
|
82
|
|
|
return true; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
return parent::__isset($property); |
86
|
|
|
} |
87
|
|
|
} |
88
|
|
|
|
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.