for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Marek\Toggable\API\Toggl\Values;
use Marek\Toggable\API\Exception\PropertyNotFoundException;
use RuntimeException;
/**
* Class ValueObject
* @package Marek\Toggable\API\Toggl\Values
*/
abstract class ValueObject
{
* Construct object optionally with a set of properties.
*
* Readonly properties values must be set using $properties as they are not writable anymore
* after object has been created.
* @param array $properties
* @throws \Marek\Toggable\API\Exception\PropertyNotFoundException
public function __construct(array $properties = array())
foreach ($properties as $property => $value) {
if (property_exists($this, $property)) {
$this->$property = $value;
} else {
throw new PropertyNotFoundException($property, get_class($this));
}
* @param $property
* @return mixed
public function __get($property)
return $this->$property;
* Magic isset function handling isset() to non public properties.
* Returns true for all (public/)protected/private properties.
* @ignore This method is for internal use
* @param string $property Name of the property
* @return bool
public function __isset($property)
return property_exists($this, $property);