DefaultConverter   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 22
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A convert() 0 4 1
A canConvert() 0 4 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