GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Date   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
c 2
b 0
f 0
lcom 2
cbo 1
dl 0
loc 52
ccs 10
cts 10
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setOptions() 0 10 2
A getInputSpecification() 0 19 1
1
<?php
2
/*
3
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
5
 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
6
 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
7
 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
8
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9
 */
10
11
namespace MpaCustomDoctrineHydrator\Form\Element;
12
13
use Zend\Filter\StringTrim;
14
use Zend\Form\Element\Date as ZendDate;
15
use Zend\InputFilter\InputProviderInterface;
16
17
class Date extends ZendDate implements InputProviderInterface
18
{
19
    /**
20
     * Override the type="date" because we can't
21
     * set a placeholder on html5 date input
22
     */
23
    protected $attributes = ['type' => 'text'];
24
25
    /**
26
     * Accepted options for DateTime:
27
     * - format: A \DateTime compatible string
28
     *
29
     * @param  array|\Traversable $options
30
     * @return \DateTime
31
     */
32 3
    public function setOptions($options)
33
    {
34 3
        parent::setOptions($options);
35
36 3
        if (isset($this->options['date_format'])) {
37 1
            $this->setFormat($this->options['date_format']);
38
        }
39
40 3
        return $this;
41
    }
42
43
    /**
44
     * Provide default input rules for this element
45
     * Attaches default validators for the Date input.
46
     *
47
     * @return array
48
     */
49 5
    public function getInputSpecification()
50
    {
51
        return [
52 5
            'name'       => $this->getName(),
53
            'required'   => true,
54
            'filters'    => [
55
                ['name' => StringTrim::class],
56
                [
57 5
                    'name'    => 'MpaCustomDoctrineHydrator\Filter\DateToDateTime',
58
                    'options' => [
59 5
                        'date_format' => $this->getFormat(),
60
                    ]
61
                ],
62
            ],
63
            'validators' => [
64 5
                $this->getDateValidator()
65
            ],
66
        ];
67
    }
68
}
69