Completed
Push — pull-request/8500 ( e49efc )
by Kamil
18:54
created

ShopExtension   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 27
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getFunctions() 0 8 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Sylius\Bundle\AdminBundle\Twig;
6
7
final class ShopExtension extends \Twig_Extension
8
{
9
    /**
10
     * @var bool
11
     */
12
    private $isShopEnabled;
13
14
    /**
15
     * @param bool $isShopEnabled
16
     */
17
    public function __construct(bool $isShopEnabled)
18
    {
19
        $this->isShopEnabled = $isShopEnabled;
20
    }
21
22
    /**
23
     * @return array|\Twig_Function[]
24
     */
25
    public function getFunctions(): array
26
    {
27
        return [
28
            new \Twig_Function('is_shop_enabled', function(): bool {
29
                return $this->isShopEnabled;
30
            })
31
        ];
32
    }
33
}
34