Completed
Push — master ( 31741c...acf815 )
by Benjamin
11:01 queued 06:10
created

AssetsExtension::getObblmJs()   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 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 2
crap 2
1
<?php
2
3
namespace Obblm\Core\Twig;
4
5
use Obblm\Core\Entity\Rule;
6
use Obblm\Core\Entity\Team;
7
use Obblm\Core\Helper\AssetPackager;
8
use Obblm\Core\Helper\ImageHelper;
9
use Twig\Extension\AbstractExtension;
10
use Twig\TwigFunction;
11
12
class AssetsExtension extends AbstractExtension
13
{
14
    protected $imageHelper;
15
    protected $packager;
16
17
    public function __construct(AssetPackager $packager, ImageHelper $imageHelper)
18
    {
19
        $this->packager = $packager;
20
        $this->imageHelper = $imageHelper;
21
    }
22
23
    public function getFunctions()
24
    {
25
        return [
26
            new TwigFunction('roster_image', [$this, 'getRosterImageUrl']),
27
            new TwigFunction('team_logo', [$this, 'getTeamLogo']),
28
            new TwigFunction('team_cover', [$this, 'getTeamCover']),
29
            new TwigFunction('obblm_css', [$this, 'getObblmCss']),
30
            new TwigFunction('obblm_js', [$this, 'getObblmJs']),
31
        ];
32
    }
33
34
    public function getObblmCss(string $entrypoint, $bundle = 'core')
0 ignored issues
show
Unused Code introduced by
The parameter $bundle is not used and could be removed. ( Ignorable by Annotation )

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

34
    public function getObblmCss(string $entrypoint, /** @scrutinizer ignore-unused */ $bundle = 'core')

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
35
    {
36
        return $this->packager->getCssEntry($entrypoint);
37
    }
38
39
    public function getObblmJs(string $entrypoint, $bundle = 'core')
0 ignored issues
show
Unused Code introduced by
The parameter $bundle is not used and could be removed. ( Ignorable by Annotation )

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

39
    public function getObblmJs(string $entrypoint, /** @scrutinizer ignore-unused */ $bundle = 'core')

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
40
    {
41
        return $this->packager->getJsEntry($entrypoint);
42
    }
43
44
    public function getRosterImageUrl(Rule $rule, string $roster, int $width = null, int $height = 150)
45
    {
46
        return $this->imageHelper->getRosterImage($rule, $roster, $width, $height);
47
    }
48
49
    public function getTeamLogo(Team $team, int $width = 200, int $height = null)
50
    {
51
        return $this->imageHelper->getTeamLogo($team, $width, $height);
52
    }
53
54
    public function getTeamCover(Team $team, int $width = null, int $height = null)
55
    {
56
        return $this->imageHelper->getTeamCover($team, $width, $height);
57
    }
58
}
59