ExampleField::getViewType()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Psi\Bundle\ContentType\Example\src;
4
5
use Psi\Component\ContentType\FieldInterface;
6
use Psi\Component\ContentType\OptionsResolver\FieldOptionsResolver;
7
use Psi\Component\ContentType\Standard\Storage\StringType;
8
use Psi\Component\ContentType\View\ScalarView;
9
use Symfony\Component\Form\Extension\Core\Type\TextType;
10
11
class ExampleField implements FieldInterface
12
{
13
    /**
14
     * {@inheritdoc}
15
     */
16
    public function getViewType(): string
17
    {
18
        return ScalarView::class;
19
    }
20
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function getFormType(): string
25
    {
26
        return TextType::class;
27
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32
    public function getStorageType(): string
33
    {
34
        return StringType::class;
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function configureOptions(FieldOptionsResolver $options)
41
    {
42
        $options->setDefaults([
43
            'foobar' => 'barfoo',
44
            'barbar' => 'booboo',
45
        ]);
46
        $options->setRequired('darf');
47
    }
48
}
49