getBundle() public method

Returns a bundle and optionally its descendants by its name.
public getBundle ( string $name, boolean $first = true ) : Symfony\Component\HttpKernel\Bundle\BundleInterface | Array
$name string Bundle name
$first boolean Whether to return the first bundle only or together with its descendants
return Symfony\Component\HttpKernel\Bundle\BundleInterface | Array A BundleInterface instance or an array of BundleInterface instances if $first is false
Beispiel #1
0
 /**
  * {@inheritdoc}
  */
 public function getBundle($name, $first = true)
 {
     // if need to get this precise bundle
     if (strpos($name, '!') === 0) {
         $name = substr($name, 1);
         if (isset($this->bundleMap[$name])) {
             // current bundle is always the last
             $bundle = end($this->bundleMap[$name]);
             return $first ? $bundle : array($bundle);
         }
     }
     return parent::getBundle($name, $first);
 }