WanderRuntime   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 18
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A sectorImgUrl() 0 4 1
1
<?php
2
3
namespace App\Twig;
4
5
use App\Entity\Wander;
6
use Twig\Extension\RuntimeExtensionInterface;
7
8
class WanderRuntime implements RuntimeExtensionInterface
9
{
10
    /** @var string */
11
    private $imgUrl;
12
13
    /** @var string */
14
    private $fileType;
15
16
    public function __construct(string $sectorImgUrl, string $sectorImgUrlFileType)
17
    {
18
        $this->imgUrl = $sectorImgUrl; // e.g. '/images/sectors/'
19
        $this->fileType = $sectorImgUrlFileType;
20
    }
21
22
    public function sectorImgUrl(Wander $wander): string
23
    {
24
        // TODO: Maybe default to an unknown image?
25
        return $this->imgUrl . $wander->getSector() . '.' . $this->fileType;
26
    }
27
}