| 1 |
<?php |
| 2 |
|
| 3 |
namespace Depicter\Document\Models\Traits; |
| 4 |
|
| 5 |
trait EntityPropertiesTrait { |
| 6 |
|
| 7 |
/** |
| 8 |
* Document entity params |
| 9 |
* |
| 10 |
* @var array |
| 11 |
*/ |
| 12 |
private $entityProperties = []; |
| 13 |
|
| 14 |
|
| 15 |
/** |
| 16 |
* Sets entity properties |
| 17 |
* |
| 18 |
* @param array $properties |
| 19 |
* |
| 20 |
* @return void |
| 21 |
*/ |
| 22 |
public function setEntityProperties( $properties = [] ) |
| 23 |
{ |
| 24 |
$this->entityProperties = $properties; |
| 25 |
} |
| 26 |
|
| 27 |
/** |
| 28 |
* Retrieves entity properties |
| 29 |
* |
| 30 |
* @return array |
| 31 |
*/ |
| 32 |
public function getEntityProperties() |
| 33 |
{ |
| 34 |
return $this->entityProperties; |
| 35 |
} |
| 36 |
|
| 37 |
/** |
| 38 |
* Retrieves value of an entity property |
| 39 |
* |
| 40 |
* @return string |
| 41 |
*/ |
| 42 |
public function getEntityProperty( $propertyName = '' ) |
| 43 |
{ |
| 44 |
return $this->entityProperties[ $propertyName ] ?? ''; |
| 45 |
} |
| 46 |
|
| 47 |
/** |
| 48 |
* Sets an entity property |
| 49 |
* |
| 50 |
* @return string |
| 51 |
*/ |
| 52 |
public function setEntityProperty( $propertyName = '', $propertyValue = '' ) |
| 53 |
{ |
| 54 |
return $this->entityProperties[ $propertyName ] = $propertyValue; |
| 55 |
} |
| 56 |
|
| 57 |
} |
| 58 |
|