Exemplo n.º 1
0
 /**
  * Override the Object's constructor to always initialize some properties.
  *
  * @param array $state data to set on the object (key-value pairs)
  */
 public function __construct(array $state = [])
 {
     parent::__construct($state);
     if (empty($this->deploy_method)) {
         $this->deploy_method = 'copy';
     }
     if (empty($this->plugin_settings)) {
         $this->plugin_settings = new Options();
     }
 }
Exemplo n.º 2
0
 /**
  * Constructs a new Type.
  *
  * @param string $name
  * @param array $attributes
  * @param OptionsInterface $options
  * @param EntityTypeInterface $parent
  * @param AttributeInterface $parent_attribute
  */
 public function __construct($name, array $attributes = [], OptionsInterface $options = null, EntityTypeInterface $parent = null, AttributeInterface $parent_attribute = null)
 {
     if ($parent xor $parent_attribute) {
         throw new RuntimeException('Parent and parent-attribute must be set together. Only one given.');
     }
     parent::__construct(['options' => $options]);
     $this->name = $name;
     $this->parent = $parent;
     $this->parent_attribute = $parent_attribute;
     $this->attribute_map = $this->getDefaultAttributes();
     foreach ($attributes as $attribute) {
         $this->attribute_map->setItem($attribute->getName(), $attribute);
     }
 }
Exemplo n.º 3
0
 /**
  * @expectedException \Trellis\Common\Error\RuntimeException
  */
 public function testSetOptionsThrows()
 {
     $p = new Configurable();
     $p->getOptions()['trololo'] = 'yes';
 }