Completed
Push — ezp_30981_content_info_proxy ( 6fc040 )
by
unknown
12:44
created

ContentInfo::getOwner()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
5
 * @license For full copyright and license information view LICENSE file distributed with this source code.
6
 */
7
namespace eZ\Publish\API\Repository\Values\Content;
8
9
use eZ\Publish\API\Repository\Values\ContentType\ContentType;
10
use eZ\Publish\API\Repository\Values\User\User;
11
use eZ\Publish\API\Repository\Values\ValueObject;
12
13
/**
14
 * This class provides all version independent information of the Content object.
15
 *
16
 * @property-read mixed $id The unique id of the Content object
17
 * @property-read mixed $contentTypeId The unique id of the Content Type object the Content object is an instance of
18
 * @property-read string $name the computed name (via name schema) in the main language of the Content object
19
 * @property-read mixed $sectionId the section to which the Content object is assigned
20
 * @property-read int $currentVersionNo Current Version number is the version number of the published version or the version number of a newly created draft (which is 1).
21
 * @property-read bool $published true if there exists a published version false otherwise
22
 * @property-read mixed $ownerId the user id of the owner of the Content object
23
 * @property-read \DateTime $modificationDate Content object modification date
24
 * @property-read \DateTime $publishedDate date of the first publish
25
 * @property-read bool $alwaysAvailable Indicates if the Content object is shown in the mainlanguage if its not present in an other requested language
26
 * @property-read string $remoteId a global unique id of the Content object
27
 * @property-read string $mainLanguageCode The main language code of the Content object. If the available flag is set to true the Content is shown in this language if the requested language does not exist.
28
 * @property-read mixed $mainLocationId Identifier of the main location.
29
 * @property-read int $status status of the Content object
30
 * @property-read bool $isHidden status of the Content object
31
 */
32
class ContentInfo extends ValueObject
33
{
34
    const STATUS_DRAFT = 0;
35
    const STATUS_PUBLISHED = 1;
36
    const STATUS_TRASHED = 2;
37
38
    /**
39
     * The unique id of the Content object.
40
     *
41
     * @var mixed
42
     */
43
    protected $id;
44
45
    /**
46
     * The Content Type id of the Content object.
47
     *
48
     * @var mixed
49
     */
50
    protected $contentTypeId;
51
52
    /**
53
     * The computed name (via name schema) in the main language of the Content object.
54
     *
55
     * For names in other languages then main see {@see \eZ\Publish\API\Repository\Values\Content\VersionInfo}
56
     *
57
     * @var string
58
     */
59
    protected $name;
60
61
    /**
62
     * The section to which the Content object is assigned.
63
     *
64
     * @var mixed
65
     */
66
    protected $sectionId;
67
68
    /**
69
     * Current Version number is the version number of the published version or the version number of
70
     * a newly created draft (which is 1).
71
     *
72
     * @var int
73
     */
74
    protected $currentVersionNo;
75
76
    /**
77
     * True if there exists a published version, false otherwise.
78
     *
79
     * @var bool Constant.
80
     */
81
    protected $published;
82
83
    /**
84
     * The owner of the Content object.
85
     *
86
     * @var mixed
87
     */
88
    protected $ownerId;
89
90
    /**
91
     * Content modification date.
92
     *
93
     * @var \DateTime
94
     */
95
    protected $modificationDate;
96
97
    /**
98
     * Content publication date.
99
     *
100
     * @var \DateTime
101
     */
102
    protected $publishedDate;
103
104
    /**
105
     * Indicates if the Content object is shown in the mainlanguage if its not present in an other requested language.
106
     *
107
     * @var bool
108
     */
109
    protected $alwaysAvailable;
110
111
    /**
112
     * Remote identifier used as a custom identifier for the object.
113
     *
114
     * @var string
115
     */
116
    protected $remoteId;
117
118
    /**
119
     * The main language code of the Content object.
120
     *
121
     * @var string
122
     */
123
    protected $mainLanguageCode;
124
125
    /**
126
     * Identifier of the main location.
127
     *
128
     * If the Content object has multiple locations,
129
     * $mainLocationId will point to the main one.
130
     *
131
     * @var mixed
132
     */
133
    protected $mainLocationId;
134
135
    /**
136
     * Status of the content.
137
     *
138
     * Replaces deprecated API\ContentInfo::$published.
139
     *
140
     * @var int
141
     */
142
    protected $status;
143
144
    /** @var bool */
145
    protected $isHidden;
146
147
    /** @var \eZ\Publish\API\Repository\Values\ContentType\ContentType */
148
    protected $contentType;
149
150
    /** @var \eZ\Publish\API\Repository\Values\Content\Section */
151
    protected $section;
152
153
    /** @var \eZ\Publish\API\Repository\Values\Content\Language */
154
    protected $mainLanguage;
155
156
    /** @var \eZ\Publish\API\Repository\Values\Content\Location */
157
    protected $mainLocation;
158
159
    /** @var \eZ\Publish\API\Repository\Values\User\User */
160
    protected $owner;
161
162
    /**
163
     * @return bool
164
     */
165
    public function isDraft()
166
    {
167
        return $this->status === self::STATUS_DRAFT;
168
    }
169
170
    /**
171
     * @return bool
172
     */
173
    public function isPublished()
174
    {
175
        return $this->status === self::STATUS_PUBLISHED;
176
    }
177
178
    /**
179
     * @return bool
180
     */
181
    public function isTrashed()
182
    {
183
        return $this->status === self::STATUS_TRASHED;
184
    }
185
186
    public function getContentType(): ContentType
187
    {
188
        return $this->contentType;
189
    }
190
191
    public function getSection(): Section
192
    {
193
        return $this->section;
194
    }
195
196
    public function getMainLanguage(): Language
197
    {
198
        return $this->mainLanguage;
199
    }
200
201
    public function getMainLocation(): Location
202
    {
203
        return $this->mainLocation;
204
    }
205
206
    public function getOwner(): User
207
    {
208
        return $this->owner;
209
    }
210
}
211