/**
  * @param $context
  * @param $methodName
  * @param Node|null $node
  *
  * @return string|null
  */
 protected function getType($context, $methodName, Node $node = null)
 {
     if ($this->isController($context)) {
         switch ($methodName) {
             case 'getDoctrine':
                 return 'Doctrine\\Bundle\\DoctrineBundle\\Registry';
             case 'createForm':
                 return 'Symfony\\Component\\Form\\Form';
             case 'createFormBuilder':
                 return 'Symfony\\Component\\Form\\FormBuilder';
         }
     }
     if ('get' === $methodName && ($this->isController($context) || self::CONTAINER == $context)) {
         if ($node instanceof Node && isset($node->var) && ($node->var->name == 'this' || $node->var->name == 'container')) {
             if ($node->args[0]->value instanceof Node\Scalar\String_) {
                 $serviceId = $node->args[0]->value->value;
             } elseif ($node->args[0]->value instanceof Node\Expr\Variable) {
                 // TODO: resolve variables
             }
             if (isset($serviceId) && $this->container->has($serviceId)) {
                 return $this->container->get($serviceId);
             }
         }
         return;
     }
     return;
 }
 /**
  * @expectedException \BadMethodCallException
  */
 public function testInvalidCall()
 {
     $container = new ContainerReader();
     $loaded = $container->loadContainer(__DIR__ . '/containerDump.xml');
     $container->getDefinition('service.unit');
 }
 /**
  * @param Configuration $configuration
  *
  * @return ComposedResolver
  */
 private function getSymbolTableVariableResolver(Configuration $configuration)
 {
     $composedResolver = new ComposedResolver();
     $composedResolver->addResolver(new ArgumentResolver($this->symbolTable));
     $composedResolver->addResolver(new ReattachStateToVariable($this->symbolTable));
     $composedResolver->addResolver(new ReattachStateToProperty($this->symbolTable));
     $composedResolver->addResolver(new VariableAssignResolver($this->symbolTable));
     $composedResolver->addResolver(new PropertyAssignResolver($this->symbolTable));
     /* @TODO: only load the container if the project is a symfony project */
     $containerReader = new ContainerReader();
     $containerReader->loadContainer($configuration->containerPath());
     $composedResolver->addResolver(new SymfonyResolver($this->symbolTable, $containerReader));
     return $composedResolver;
 }