PhotoExtension   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 21
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getMealPhoto() 0 4 1
A getFunctions() 0 6 1
1
<?php
2
3
namespace AppBundle\Twig;
4
5
use AppBundle\Entity\Meal;
6
use AppBundle\Service\PhotoService;
7
8
class PhotoExtension extends \Twig_Extension
9
{
10
    private $photoService;
11
12
    public function __construct(PhotoService $photoService)
13
    {
14
        $this->photoService = $photoService;
15
    }
16
17
    public function getMealPhoto(Meal $meal, $size)
18
    {
19
        return $this->photoService->get($meal, $size);
20
    }
21
22
    public function getFunctions()
23
    {
24
        return array(
25
            new \Twig_SimpleFunction('get_meal_photo', array($this, 'getMealPhoto'))
26
        );
27
    }
28
}
29