Completed
Push — master ( a77e74...195f16 )
by Loïc
16s queued 10s
created

CustomerStatistic   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A generate() 0 8 1
A getDefaultPriority() 0 4 1
1
<?php
2
3
namespace App\Dashboard\Statistics;
4
5
use App\Repository\CustomerRepository;
6
use Symfony\Component\Templating\EngineInterface;
7
8
class CustomerStatistic implements StatisticInterface
9
{
10
    /** @var CustomerRepository */
11
    private $customerRepository;
12
13
    /** @var EngineInterface */
14
    private $engine;
15
16
    public function __construct(CustomerRepository $customerRepository, EngineInterface $engine)
17
    {
18
        $this->customerRepository = $customerRepository;
19
        $this->engine = $engine;
20
    }
21
22
    public function generate(): string
23
    {
24
        $amountCustomers = $this->customerRepository->countCustomers();
25
26
        return $this->engine->render('backend/dashboard/statistics/_amount_of_customers.html.twig', [
27
            'amountOfCustomers' => $amountCustomers,
28
        ]);
29
    }
30
31
    public static function getDefaultPriority(): int
32
    {
33
        return -1;
34
    }
35
}
36