/**
  * @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;
 }
 public function testLoadValidDump()
 {
     $container = new ContainerReader();
     $loaded = $container->loadContainer(__DIR__ . '/containerDump.xml');
     $this->assertTrue($loaded);
     $this->assertTrue($container->has('service.unit'));
     $this->assertFalse($container->has('service.invalid'));
     $this->assertEquals('UnitTest\\Class', $container->get('service.unit'));
     $this->assertNull($container->get('service.unit2'));
 }