DefaultHandler   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 18
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A expand() 0 11 3
1
<?php
2
3
namespace Drupal\Driver\Fields\Drupal7;
4
5
/**
6
 * Default field handler for Drupal 7.
7
 */
8
class DefaultHandler extends AbstractHandler {
9
10
  /**
11
   * {@inheritdoc}
12
   */
13
  public function expand($values) {
14
    $return = [];
15
    foreach ($values as $value) {
16
      // Use the column name 'value' by default if the value is not an array.
17
      if (!is_array($value)) {
18
        $value = ['value' => $value];
19
      }
20
      $return[$this->language][] = $value;
21
    }
22
    return $return;
23
  }
24
25
}
26