Passed
Pull Request — master (#118)
by Alexander
04:27 queued 02:08
created

AssetLoaderInterfaceProxy::getAssetUrl()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\Debug\Proxy;
6
7
use Yiisoft\Assets\AssetBundle;
8
use Yiisoft\Assets\AssetLoaderInterface;
9
use Yiisoft\Yii\Debug\Collector\AssetCollector;
10
11
final class AssetLoaderInterfaceProxy implements AssetLoaderInterface
12
{
13
    public function __construct(
14
        private AssetLoaderInterface $assetLoader,
15
        private AssetCollector $assetCollector
16
    ) {
17
    }
18
19
    public function getAssetUrl(AssetBundle $bundle, string $assetPath): string
20
    {
21
        return $this->assetLoader->getAssetUrl($bundle, $assetPath);
22
    }
23
24
    public function loadBundle(string $name, array $config = []): AssetBundle
25
    {
26
        $bundle = $this->assetLoader->loadBundle($name, $config);
27
28
        $this->assetCollector->collect($bundle);
29
        return $bundle;
30
    }
31
}
32