LinkHandler   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A expand() 0 17 3
1
<?php
2
3
namespace Drupal\Driver\Fields\Drupal8;
4
5
/**
6
 * Link field handler for Drupal 8.
7
 */
8
class LinkHandler extends AbstractHandler {
9
10
  /**
11
   * {@inheritdoc}
12
   */
13
  public function expand($values) {
14
    $return = [];
15
    foreach ($values as $value) {
16
      // 'options' is required to be an array, otherwise the utility class
17
      // Drupal\Core\Utility\UnroutedUrlAssembler::assemble() will complain.
18
      $options = [];
19
      if (!empty($value[2])) {
20
        parse_str($value[2], $options);
21
      }
22
      $return[] = [
23
        'options' => $options,
24
        'title' => $value[0],
25
        'uri' => $value[1],
26
      ];
27
    }
28
    return $return;
29
  }
30
31
}
32