DefaultConverter::convert()   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 1
1
<?php
2
3
namespace Drupal\easy_entity_reader\Converters;
4
5
use Drupal\Core\Field\FieldItemInterface;
6
7
/**
8
 * Convert the default class to value.
9
 *
10
 * Class DefaultConverter.
11
 */
12
class DefaultConverter implements ConverterInterface
13
{
14
    /**
15
     * @param FieldItemInterface $value
16
     */
17
    public function convert(FieldItemInterface $value)
18
    {
19
        return $value->getValue()['value'];
20
    }
21
22
    /**
23
     * Returns whether the FieldItemInterface can be converted or not.
24
     *
25
     * @param FieldItemInterface $value
26
     *
27
     * @return bool
28
     */
29
    public function canConvert(FieldItemInterface $value) : bool
30
    {
31
        return true;
32
    }
33
}
34