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.
Completed
Push — master ( b5dfb6...a568a9 )
by Mario
40:05
created

FloatFieldHandler::getLegacyValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 7
Ratio 100 %

Importance

Changes 0
Metric Value
dl 7
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Netgen\InformationCollection\Core\Persistence\FieldHandler\Custom;
6
7
use eZ\Publish\API\Repository\Values\ContentType\FieldDefinition;
8
use eZ\Publish\Core\FieldType\Float\Value as FloatValue;
9
use eZ\Publish\Core\FieldType\Value;
10
use Netgen\InformationCollection\API\FieldHandler\CustomLegacyFieldHandlerInterface;
11
use Netgen\InformationCollection\API\Value\Legacy\FieldValue;
12
13 View Code Duplication
class FloatFieldHandler implements CustomLegacyFieldHandlerInterface
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
14
{
15
    /**
16
     * {@inheritdoc}
17
     */
18
    public function supports(Value $value): bool
19
    {
20
        return $value instanceof FloatValue;
21
    }
22
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public function toString(Value $value, FieldDefinition $fieldDefinition): string
27
    {
28
        return (string) $value;
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    public function getLegacyValue(Value $value, FieldDefinition $fieldDefinition): FieldValue
35
    {
36
        return new FieldValue([
37
            'fieldDefinitionId' => $fieldDefinition->id,
38
            'dataFloat' => $value->value,
39
        ]);
40
    }
41
}
42