Ejemplo n.º 1
0
 /**
  * @param string $name
  * @return BaseToken
  * @throws Exceptions\ParserException
  */
 public function getVariable($name)
 {
     if (!array_key_exists($name, $this->variables)) {
         $token = $this->stack->current();
         throw new Exceptions\ParserException(sprintf('Undefined variable "%s" at position %d on line %d', $name, $token->getPosition(), $token->getLine()));
     }
     return TokenFactory::createFromPHPType($this->variables[$name]);
 }
Ejemplo n.º 2
0
 /**
  * @expectedException \Exception
  * @expectedExceptionMessage Unsupported PHP type: "object"
  */
 public function testUnsupportedTypeThrowsException()
 {
     TokenFactory::createFromPHPType(new \StdClass());
 }