Completed
Pull Request — master (#232)
by
unknown
02:07
created

CustomerStatistic   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 5 1
A generate() 0 8 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
    /**
11
     * @var CustomerRepository
12
     */
13
    private $customerRepository;
14
15
    /**
16
     * @var EngineInterface
17
     */
18
    private $engine;
19
20
    public function __construct(CustomerRepository $customerRepository, EngineInterface $engine)
21
    {
22
        $this->customerRepository = $customerRepository;
23
        $this->engine = $engine;
24
    }
25
26
    public function generate(): string
27
    {
28
        $amountCustomers = $this->customerRepository->countCustomers();
29
30
        return $this->engine->render('backend/dashboard/statistics/_amount_of_customers.html.twig', [
31
            'amountOfCustomers' => $amountCustomers,
32
        ]);
33
    }
34
}
35