Skip to content
PHP Ecosystem
Explore

AssetLoaderProxy

API reference › Yii3 Debug › Collector › AssetLoaderProxy

final readonly classYii3\Debug\Collector\AssetLoaderProxy
ImplementsYiisoft\Assets\AssetLoaderInterface
Sourcesrc/Collector/AssetLoaderProxy.php

Intercepts AssetLoaderInterface::loadBundle() to feed the loaded bundle to the AssetCollector.

MethodDescriptionDefined by
__construct()Creates a transparent asset-loader proxy that records each loaded bundle.AssetLoaderProxy
getAssetUrl()Returns the asset URL the application loader resolves.AssetLoaderProxy
loadBundle()Records the bundle the application loader resolved, then returns it unchanged.AssetLoaderProxy
public function __construct(Yiisoft\Assets\AssetLoaderInterface $loader, Yii3\Debug\Collector\AssetCollector $collector)

Creates a transparent asset-loader proxy that records each loaded bundle.

Parameters

ParameterTypeDescription
$loaderYiisoft\Assets\AssetLoaderInterfaceApplication loader every call is delegated to.
$collectorAssetCollectorCollector recording the bundles the application loads.
public function getAssetUrl(Yiisoft\Assets\AssetBundle $bundle, string $assetPath): string

Returns the asset URL the application loader resolves.

Parameters

ParameterTypeDescription
$bundleYiisoft\Assets\AssetBundleBundle the asset file belongs to.
$assetPathstringAsset path declared by the bundle.

Returns

string: Actual URL of the asset.

public function loadBundle(string $name, array $config = []): Yiisoft\Assets\AssetBundle

Records the bundle the application loader resolved, then returns it unchanged.

Parameters

ParameterTypeDescription
$namestringBundle class name to load.
$configarrayBundle instance configuration.

Returns

Yiisoft\Assets\AssetBundle: Bundle as returned by the application loader.