CountStat::get()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace App\Stat\Form;
4
5
use App\Service\FormService;
6
use Ds\Component\Model\Attribute;
7
use Ds\Component\Statistic\Model\Datum;
8
use Ds\Component\Statistic\Stat\Stat;
9
10
/**
11
 * Class CountStat
12
 */
13
final class CountStat implements Stat
14
{
15
    use Attribute\Alias;
16
17
    /**
18
     * @var \App\Service\FormService
19
     */
20
    private $formService;
21
22
    /**
23
     * Constructor
24
     *
25
     * @param \App\Service\FormService $formService
26
     */
27
    public function __construct(FormService $formService)
28
    {
29
        $this->formService = $formService;
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function get(): Datum
36
    {
37
        $datum = new Datum;
38
        $datum
39
            ->setAlias($this->alias)
40
            ->setValue($this->formService->getRepository()->getCount([]));
41
42
        return $datum;
43
    }
44
}
45