yii\web\AssetManager::getBundle PHP Méthode

getBundle() public méthode

This method will first look for the bundle in [[bundles]]. If not found, it will treat $name as the class of the asset bundle and create a new instance of it.
public getBundle ( string $name, boolean $publish = true ) : AssetBundle
$name string the class name of the asset bundle (without the leading backslash)
$publish boolean whether to publish the asset files in the asset bundle before it is returned. If you set this false, you must manually call `AssetBundle::publish()` to publish the asset files.
Résultat AssetBundle the asset bundle instance
    public function getBundle($name, $publish = true)
    {
        if ($this->bundles === false) {
            return $this->loadDummyBundle($name);
        } elseif (!isset($this->bundles[$name])) {
            return $this->bundles[$name] = $this->loadBundle($name, [], $publish);
        } elseif ($this->bundles[$name] instanceof AssetBundle) {
            return $this->bundles[$name];
        } elseif (is_array($this->bundles[$name])) {
            return $this->bundles[$name] = $this->loadBundle($name, $this->bundles[$name], $publish);
        } elseif ($this->bundles[$name] === false) {
            return $this->loadDummyBundle($name);
        } else {
            throw new InvalidConfigException("Invalid asset bundle configuration: {$name}");
        }
    }