/**
  * Adds a EncoderNodeVariable to the collection
  * @param EncoderNodeVariable $variable
  * @return EncoderNodeVariable
  */
 public function addVariable(EncoderNodeVariable $variable)
 {
     $id = $variable->getId();
     if ($this->variableExists($id)) {
         throw new EncoderNodeVariableCollectionException(sprintf('Trying to add a EncoderNodeVariable but a variable with id "%s" already exists', $id));
     }
     $this->variables[$id] = $variable;
     return $variable;
 }
 public function testConstructor()
 {
     $variable = new EncoderNodeVariable('var');
     $this->assertNotNull($variable);
     $this->assertTrue($variable instanceof EncoderNodeVariable);
     $this->assertEquals('PE\\Variables\\Types\\ObjectSetter', get_class($variable->getObjectSetter()));
     $this->assertEquals('PE\\Variables\\Types\\ObjectGetter', get_class($variable->getObjectGetter()));
     $variable = new EncoderNodeVariable('var', false);
     $this->assertNull($variable->getObjectSetter());
     $this->assertNull($variable->getObjectGetter());
 }
 function __construct($id, $method)
 {
     parent::__construct($id, false);
     $this->setType(EncoderNodeVariable::TYPE_BOOL);
     $this->objectSetter(new ObjectSetter($method));
     $this->objectGetter(new ObjectGetter($method));
 }