public function processContainerBuilder(GenerationContext $context)
    {
        $definition = $context->getServiceDefinition();
        $serviceName = $context->getServiceName();
        $annotation = $context->getAnnotation();
        /* @var $annotation \Nucleus\Binder\Bounding */
        $code = Definition::getCodeInitalization($definition);
        $annotation->scope;
        if (!is_null($annotation->variableName)) {
            $variableName = $annotation->variableName;
        } else {
            $variableName = $context->getParsingContextName();
        }
        if (!is_null($annotation->namespace)) {
            $namespace = $annotation->namespace;
        } else {
            $namespace = $serviceName;
        }
        $scope = $annotation->scope;
        $serviceBinderAssignation = '
    $sessionServiceBinder = $serviceContainer->get("' . IBinder::NUCLEUS_SERVICE_NAME . '");
';
        if (strpos($code, $serviceBinderAssignation) === false) {
            $code .= $serviceBinderAssignation;
        }
        $code .= '
    $sessionServiceBinder->restore($service,"' . $variableName . '","' . $namespace . '","' . $scope . '");
';
        Definition::setCodeInitialization($definition, $code);
    }
 public function processContainerBuilder(GenerationContext $context)
 {
     $annotation = $context->getAnnotation();
     /* @var $annotation \Nucleus\Bundle\ConsoleBundle\Command\CommandLine */
     $serviceName = $context->getServiceName();
     $methodName = $context->getParsingContextName();
     $definition = $context->getContainerBuilder()->getDefinition($serviceName);
     $shortDesc = 'N/A';
     $reflectedMethod = new \ReflectionMethod($definition->getClass(), $methodName);
     $methodComment = $reflectedMethod->getDocComment();
     $paramArrayComments = array();
     if ($methodComment !== false) {
         list($shortDesc, $paramArrayComments) = $this->parseBlockDocComment($methodComment);
     }
     $paramsArray = array();
     foreach ($reflectedMethod->getParameters() as $reflectionParameter) {
         if ($reflectionParameter->getClass()) {
             continue;
         }
         $paramComment = 'N/A';
         if (isset($paramArrayComments[$reflectionParameter->getName()])) {
             $paramComment = $paramArrayComments[$reflectionParameter->getName()];
         }
         $paramsArray[$reflectionParameter->getName()]['optional'] = false;
         if ($reflectionParameter->isDefaultValueAvailable()) {
             $paramsArray[$reflectionParameter->getName()]['optional'] = true;
         }
         $paramsArray[$reflectionParameter->getName()]['comment'] = $paramComment;
     }
     if (!empty($annotation->name)) {
         $name = $annotation->name;
     } else {
         $name = $serviceName . ':' . $methodName;
     }
     if ($context->getContainerBuilder()->hasParameter(self::CONTAINER_COMMANDS_PARAMETER)) {
         $commands = $context->getContainerBuilder()->getParameter(self::CONTAINER_COMMANDS_PARAMETER);
     } else {
         $commands = array();
     }
     $commands[] = compact('name', 'shortDesc', 'paramsArray', 'serviceName', 'methodName');
     $context->getContainerBuilder()->setParameter(self::CONTAINER_COMMANDS_PARAMETER, $commands);
 }