Completed
Pull Request — master (#13)
by Alexandre
13:17 queued 11:14
created

PhotoExtension::getName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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