protected function createBundleObject(InputInterface $input)
    {
        foreach (array('namespace', 'dir') as $option) {
            if (null === $input->getOption($option)) {
                throw new \RuntimeException(sprintf('The "%s" option must be provided.', $option));
            }
        }

        $shared = $input->getOption('shared');

        $namespace = Validators::validateBundleNamespace($input->getOption('namespace'), $shared);
        if (!$bundleName = $input->getOption('bundle-name')) {
            $bundleName = strtr($namespace, array('\\' => ''));
        }
        $bundleName = Validators::validateBundleName($bundleName);
        $dir = $input->getOption('dir');
        if (null === $input->getOption('format')) {
            $input->setOption('format', 'annotation');
        }
        $format = Validators::validateFormat($input->getOption('format'));

        // an assumption that the kernel root dir is in a directory (like app/)
        $projectRootDirectory = $this->getContainer()->getParameter('kernel.root_dir').'/..';

        if (!$this->getContainer()->get('filesystem')->isAbsolutePath($dir)) {
            $dir = $projectRootDirectory.'/'.$dir;
        }
        // add trailing / if necessary
        $dir = '/' === substr($dir, -1, 1) ? $dir : $dir.'/';

        $bundle = new Bundle(
            $namespace,
            $bundleName,
            $dir,
            $format,
            $shared
        );

        // not shared - put the tests in the root
        if (!$shared) {
            $testsDir = $projectRootDirectory.'/tests/'.$bundleName;
            $bundle->setTestsDirectory($testsDir);
        }

        return $bundle;
    }
protected function createBundleObject(InputInterface $input)
    {
        foreach (array('namespace', 'dir') as $option) {
            if (null === $input->getOption($option)) {
                throw new \RuntimeException(sprintf('The "%s" option must be provided.', $option));
            }
        }

        $shared = $input->getOption('shared');

        $namespace = Validators::validateBundleNamespace($input->getOption('namespace'), $shared);
        if (!$bundleName = $input->getOption('bundle-name')) {
            $bundleName = strtr($namespace, array('\\' => ''));
        }
        $bundleName = Validators::validateBundleName($bundleName);
        $dir = $input->getOption('dir');
        if (null === $input->getOption('format')) {
            $input->setOption('format', 'annotation');
        }
        $format = Validators::validateFormat($input->getOption('format'));

        
        $projectRootDirectory = $this->getContainer()->getParameter('kernel.root_dir').'/..';

        if (!$this->getContainer()->get('filesystem')->isAbsolutePath($dir)) {
            $dir = $projectRootDirectory.'/'.$dir;
        }
        
        $dir = '/' === substr($dir, -1, 1) ? $dir : $dir.'/';

        $bundle = new Bundle(
            $namespace,
            $bundleName,
            $dir,
            $format,
            $shared
        );

        
        if (!$shared) {
            $testsDir = $projectRootDirectory.'/tests/'.$bundleName;
            $bundle->setTestsDirectory($testsDir);
        }

        return $bundle;
    }
protected function createBundleObject ( InputInterface $ input ) { foreach ( array ( 'namespace' , 'dir' ) as $ option ) { if ( null === $ input -> getOption ( $ option ) ) { throw new \ RuntimeException ( sprintf ( 'The "%s" option must be provided.' , $ option ) ) ; } } $ shared = $ input -> getOption ( 'shared' ) ; $ namespace = Validators :: validateBundleNamespace ( $ input -> getOption ( 'namespace' ) , $ shared ) ; if ( ! $ bundleName = $ input -> getOption ( 'bundle-name' ) ) { $ bundleName = strtr ( $ namespace , array ( '\\' => '' ) ) ; } $ bundleName = Validators :: validateBundleName ( $ bundleName ) ; $ dir = $ input -> getOption ( 'dir' ) ; if ( null === $ input -> getOption ( 'format' ) ) { $ input -> setOption ( 'format' , 'annotation' ) ; } $ format = Validators :: validateFormat ( $ input -> getOption ( 'format' ) ) ; // an assumption that the kernel root dir is in a directory (like app/) $ projectRootDirectory = $ this -> getContainer ( ) -> getParameter ( 'kernel.root_dir' ) . '/..' ; if ( ! $ this -> getContainer ( ) -> get ( 'filesystem' ) -> isAbsolutePath ( $ dir ) ) { $ dir = $ projectRootDirectory . '/' . $ dir ; } // add trailing / if necessary $ dir = '/' === substr ( $ dir , - 1 , 1 ) ? $ dir : $ dir . '/' ; $ bundle = new Bundle ( $ namespace , $ bundleName , $ dir , $ format , $ shared ) ; // not shared - put the tests in the root if ( ! $ shared ) { $ testsDir = $ projectRootDirectory . '/tests/' . $ bundleName ; $ bundle -> setTestsDirectory ( $ testsDir ) ; } return $ bundle ; }
Creates the Bundle object based on the user's (non-interactive) input.

@param InputInterface $input

@return Bundle
Creates the Bundle object based on the user s ( non - interactive ) input .