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

CustomerStatistic::generate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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