Completed
Pull Request — master (#98)
by
unknown
02:45
created

DatestampHandler::expand()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 17
Code Lines 11

Duplication

Lines 6
Ratio 35.29 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 6
loc 17
rs 9.2
cc 4
eloc 11
nc 4
nop 1
1
<?php
2
3
namespace Drupal\Driver\Fields\Drupal7;
4
5
/**
6
 * Datestamp field handler for Drupal 7.
7
 */
8
class DatestampHandler extends AbstractHandler {
9
10
  /**
11
   * {@inheritdoc}
12
   */
13
  public function expand($values) {
14
    $return = array();
15
    if (isset($this->fieldInfo['columns']['value2'])) {
16 View Code Duplication
      foreach ($values as $value) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
17
        $return[$this->language][] = array(
18
          'value' => strtotime($value[0]),
19
          'value2' => strtotime($value[1]),
20
        );
21
      }
22
    }
23
    else {
24
      foreach ($values as $value) {
25
        $return[$this->language][] = array('value' => strtotime($value));
26
      }
27
    }
28
    return $return;
29
  }
30
31
}
32