1
|
|
|
<?php |
2
|
|
|
namespace Dkd\PhpCmis\DataObjects; |
3
|
|
|
|
4
|
|
|
/* |
5
|
|
|
* This file is part of php-cmis-client. |
6
|
|
|
* |
7
|
|
|
* (c) Sascha Egerer <[email protected]> |
8
|
|
|
* |
9
|
|
|
* For the full copyright and license information, please view the LICENSE |
10
|
|
|
* file that was distributed with this source code. |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
use Dkd\PhpCmis\Data\PropertyInterface; |
14
|
|
|
use Dkd\PhpCmis\Definitions\PropertyDefinitionInterface; |
15
|
|
|
use Dkd\PhpCmis\Enum\Cardinality; |
16
|
|
|
use Dkd\PhpCmis\Enum\PropertyType; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Property Implementation. |
20
|
|
|
*/ |
21
|
|
|
class Property extends AbstractPropertyData implements PropertyInterface |
22
|
|
|
{ |
23
|
|
|
/** |
24
|
|
|
* @var PropertyDefinitionInterface |
25
|
|
|
*/ |
26
|
|
|
protected $propertyDefinition; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Initialize the property with its definition and values |
30
|
|
|
* |
31
|
|
|
* @param PropertyDefinitionInterface $propertyDefinition |
32
|
|
|
* @param mixed[] $values |
33
|
|
|
*/ |
34
|
|
|
public function __construct(PropertyDefinitionInterface $propertyDefinition, array $values) |
35
|
|
|
{ |
36
|
|
|
$this->propertyDefinition = $propertyDefinition; |
37
|
|
|
$this->setId($propertyDefinition->getId()); |
38
|
|
|
$this->setDisplayName($propertyDefinition->getDisplayName()); |
39
|
|
|
$this->setLocalName($propertyDefinition->getLocalName()); |
40
|
|
|
$this->setQueryName($propertyDefinition->getQueryName()); |
41
|
|
|
$this->setValues($values); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Returns if the property is a multi-value property. |
46
|
|
|
* |
47
|
|
|
* @return boolean <code>true</code> if the property is multi-value property, <code>false</code> if the property is |
48
|
|
|
* single-value property, |
49
|
|
|
*/ |
50
|
|
|
public function isMultiValued() |
51
|
|
|
{ |
52
|
|
|
return Cardinality::cast($this->getDefinition()->getCardinality())->equals(Cardinality::MULTI); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* Returns the property data type. |
57
|
|
|
* |
58
|
|
|
* @return PropertyType the data type of the property |
59
|
|
|
*/ |
60
|
|
|
public function getType() |
61
|
|
|
{ |
62
|
|
|
return $this->getDefinition()->getPropertyType(); |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Returns the property definition. |
67
|
|
|
* |
68
|
|
|
* @return PropertyDefinitionInterface the property definition |
69
|
|
|
*/ |
70
|
|
|
public function getDefinition() |
71
|
|
|
{ |
72
|
|
|
return $this->propertyDefinition; |
73
|
|
|
} |
74
|
|
|
} |
75
|
|
|
|