Completed
Push — master ( 33de91...d9461a )
by Jonathan
01:31
created

DaterangeHandler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A expand() 0 12 2
1
<?php
2
3
namespace Drupal\Driver\Fields\Drupal8;
4
5
/**
6
 * Daterange field handler for Drupal 8.
7
 */
8
class DaterangeHandler extends AbstractHandler {
9
10
  /**
11
   * {@inheritdoc}
12
   */
13
  public function expand($values) {
14
    $return = [];
15
    foreach ($values as $value) {
16
      $start = str_replace(' ', 'T', $value[0]);
17
      $end = str_replace(' ', 'T', $value[1]);
18
      $return[] = [
19
        'value' => $start,
20
        'end_value' => $end,
21
      ];
22
    }
23
    return $return;
24
  }
25
26
}
27