DefaultHandler::expand()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
cc 3
nc 3
nop 1
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