Passed
Pull Request — master (#347)
by Mirko
07:40
created

UploadFieldNotesDataProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getData() 0 6 1
1
<?php
2
3
namespace AppBundle\Form\DataProvider;
4
5
use AppBundle\Form\UploadFieldNotesType;
6
use AppBundle\Service\Interfaces\FieldNoteServiceInterface;
7
use AppBundle\Util\DateUtil;
8
9
class UploadFieldNotesDataProvider
10
{
11
    /**
12
     * @var \AppBundle\Service\Interfaces\FieldNoteServiceInterface
13
     */
14
    protected $fieldNoteService;
15
16
    /**
17
     * @var int
18
     */
19
    protected $userId;
20
21
    /**
22
     * UploadFieldNotesDataProvider constructor.
23
     *
24
     * @param \AppBundle\Service\Interfaces\FieldNoteServiceInterface $fieldNoteService
25
     */
26
    public function __construct(FieldNoteServiceInterface $fieldNoteService)
27
    {
28
        $this->fieldNoteService = $fieldNoteService;
29
    }
30
31
    /**
32
     * @param int $userId
33
     *
34
     * @return array
35
     */
36
    public function getData($userId)
37
    {
38
        return [
39
            UploadFieldNotesType::FIELD_IGNORE_DATE => $this->fieldNoteService->getLatestFieldNoteOrLogDate($userId)->format(DateUtil::DATE_FORMAT_MYSQL)
40
        ];
41
    }
42
}
43