/**
  * @covers Brickoo\Component\IoC\Definition\ArgumentDefinition::__construct
  * @covers Brickoo\Component\IoC\Definition\ArgumentDefinition::getName
  * @covers Brickoo\Component\IoC\Definition\ArgumentDefinition::getValue
  */
 public function testDefinitionGetter()
 {
     $name = "MyAnnotation";
     $value = "some value";
     $annotationDefinition = new ArgumentDefinition($value, $name);
     $this->assertEquals($name, $annotationDefinition->getName());
     $this->assertEquals($value, $annotationDefinition->getValue());
 }
示例#2
0
 /**
  * Returns the argument definition resolved value.
  * @param \Brickoo\Component\IoC\Definition\ArgumentDefinition $argument
  * @return mixed the argument value
  */
 private function getArgumentValue(ArgumentDefinition $argument)
 {
     $argumentValue = $argument->getValue();
     if (is_callable($argumentValue)) {
         return call_user_func($argumentValue, $this->getDiContainer());
     }
     if (is_string($argumentValue) && strpos($argumentValue, $this->definitionPrefix) === 0) {
         return $this->getDiContainer()->retrieve(substr($argumentValue, strlen($this->definitionPrefix)));
     }
     return $argumentValue;
 }