HasTagRenderer   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 29
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getTagRenderer() 0 3 1
A renderWebpackLinkTags() 0 7 1
A renderWebpackScriptTags() 0 7 1
1
<?php
2
3
namespace ByTIC\Assets\AssetsManager;
4
5
use Symfony\WebpackEncoreBundle\Asset\TagRenderer;
6
7
/**
8
 * Trait HasTagRenderer
9
 * @package ByTIC\Assets\AssetsManager
10
 */
11
trait HasTagRenderer
12
{
13 4
    protected function getTagRenderer(): TagRenderer
14
    {
15 4
        return $this->getContainer()->get('assets.tag_renderer');
0 ignored issues
show
Bug introduced by
It seems like getContainer() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

15
        return $this->/** @scrutinizer ignore-call */ getContainer()->get('assets.tag_renderer');
Loading history...
16
    }
17
18
    /**
19
     * @param string $entryName
20
     * @param null $packageName
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $packageName is correct as it would always require null to be passed?
Loading history...
21
     * @param string $entrypointName
22
     * @return string
23
     */
24 2
    public function renderWebpackScriptTags(
25
        string $entryName,
26
        $packageName = null,
27
        string $entrypointName = '_default'
28
    ): string {
29 2
        return $this->getTagRenderer()
30 2
            ->renderWebpackScriptTags($entryName, $packageName, $entrypointName);
31
    }
32
33 2
    public function renderWebpackLinkTags(
34
        string $entryName,
35
        string $packageName = null,
36
        string $entrypointName = '_default'
37
    ): string {
38 2
        return $this->getTagRenderer()
39 2
            ->renderWebpackLinkTags($entryName, $packageName, $entrypointName);
40
    }
41
}
42