FormTypeReader::read()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 8
ccs 5
cts 5
cp 1
crap 2
rs 10
1
<?php
2
3
namespace JBen87\ParsleyBundle\Constraint\Reader;
4
5
use Symfony\Component\Form\FormInterface;
6
7
class FormTypeReader implements ReaderInterface
8
{
9
    /**
10
     * @inheritdoc
11
     */
12 2
    public function read(FormInterface $form): array
13
    {
14 2
        $config = $form->getConfig();
15 2
        if (false === $config->hasOption('constraints')) {
16 1
            return [];
17
        }
18
19 1
        return $config->getOption('constraints');
20
    }
21
22
    /**
23
     * @inheritdoc
24
     *
25
     * @codeCoverageIgnore
26
     */
27
    public function getPriority(): int
28
    {
29
        return 0;
30
    }
31
}
32