Completed
Push — 7.1 ( d4d031 )
by
unknown
24s
created

ContentInfo::isTrashed()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * File containing the eZ\Publish\API\Repository\Values\Content\ContentInfo 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\API\Repository\Values\Content;
10
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
 */
31
class ContentInfo extends ValueObject
32
{
33
    const STATUS_DRAFT = 0;
34
    const STATUS_PUBLISHED = 1;
35
    const STATUS_TRASHED = 2;
36
37
    /**
38
     * The unique id of the Content object.
39
     *
40
     * @var mixed
41
     */
42
    protected $id;
43
44
    /**
45
     * The Content Type id of the Content object.
46
     *
47
     * @var mixed
48
     */
49
    protected $contentTypeId;
50
51
    /**
52
     * The computed name (via name schema) in the main language of the Content object.
53
     *
54
     * For names in other languages then main see {@see \eZ\Publish\API\Repository\Values\Content\VersionInfo}
55
     *
56
     * @var string
57
     */
58
    protected $name;
59
60
    /**
61
     * The section to which the Content object is assigned.
62
     *
63
     * @var mixed
64
     */
65
    protected $sectionId;
66
67
    /**
68
     * Current Version number is the version number of the published version or the version number of
69
     * a newly created draft (which is 1).
70
     *
71
     * @var int
72
     */
73
    protected $currentVersionNo;
74
75
    /**
76
     * True if there exists a published version, false otherwise.
77
     *
78
     * @var bool Constant.
79
     */
80
    protected $published;
81
82
    /**
83
     * The owner of the Content object.
84
     *
85
     * @var mixed
86
     */
87
    protected $ownerId;
88
89
    /**
90
     * Content modification date.
91
     *
92
     * @var \DateTime
93
     */
94
    protected $modificationDate;
95
96
    /**
97
     * Content publication date.
98
     *
99
     * @var \DateTime
100
     */
101
    protected $publishedDate;
102
103
    /**
104
     * Indicates if the Content object is shown in the mainlanguage if its not present in an other requested language.
105
     *
106
     * @var bool
107
     */
108
    protected $alwaysAvailable;
109
110
    /**
111
     * Remote identifier used as a custom identifier for the object.
112
     *
113
     * @var string
114
     */
115
    protected $remoteId;
116
117
    /**
118
     * The main language code of the Content object.
119
     *
120
     * @var string
121
     */
122
    protected $mainLanguageCode;
123
124
    /**
125
     * Identifier of the main location.
126
     *
127
     * If the Content object has multiple locations,
128
     * $mainLocationId will point to the main one.
129
     *
130
     * @var mixed
131
     */
132
    protected $mainLocationId;
133
134
    /**
135
     * Status of the content.
136
     *
137
     * Replaces deprecated API\ContentInfo::$published.
138
     *
139
     * @var int
140
     */
141
    protected $status;
142
143
    /**
144
     * @return bool
145
     */
146
    public function isDraft()
147
    {
148
        return $this->status === self::STATUS_DRAFT;
149
    }
150
151
    /**
152
     * @return bool
153
     */
154
    public function isPublished()
155
    {
156
        return $this->status === self::STATUS_PUBLISHED;
157
    }
158
159
    /**
160
     * @return bool
161
     */
162
    public function isTrashed()
163
    {
164
        return $this->status === self::STATUS_TRASHED;
165
    }
166
}
167