Completed
Branch develop (defee6)
by Benjamin
06:13
created

AssetsExtension::getTeamLogo()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 3
dl 0
loc 3
rs 10
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\ImageHelper;
8
use Twig\Extension\AbstractExtension;
9
use Twig\TwigFunction;
10
11
class AssetsExtension extends AbstractExtension
12
{
13
    protected $imageHelper;
14
15
    public function __construct(ImageHelper $imageHelper)
16
    {
17
        $this->imageHelper = $imageHelper;
18
    }
19
20
    public function getFunctions()
21
    {
22
        return [
23
            new TwigFunction('roster_image', [$this, 'getRosterImageUrl']),
24
            new TwigFunction('team_logo', [$this, 'getTeamLogo']),
25
            new TwigFunction('team_cover', [$this, 'getTeamCover']),
26
        ];
27
    }
28
29
    public function getRosterImageUrl(Rule $rule, string $roster, int $width = null, int $height = 150)
30
    {
31
        return $this->imageHelper->getRosterImage($rule, $roster, $width, $height);
32
    }
33
34
    public function getTeamLogo(Team $team, int $width = 200, int $height = null)
35
    {
36
        return $this->imageHelper->getTeamLogo($team, $width, $height);
37
    }
38
39
    public function getTeamCover(Team $team, int $width = null, int $height = null)
40
    {
41
        return $this->imageHelper->getTeamCover($team, $width, $height);
42
    }
43
}
44