Completed
Push — master ( 445c40...d916d6 )
by Jelle
04:38
created

EntityPropertyUtil   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 5
c 3
b 0
f 0
lcom 0
cbo 0
dl 0
loc 25
ccs 9
cts 9
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B getRawValue() 0 13 5
1
<?php
2
3
/**
4
 * @file
5
 * Contains \TheSportsDb\Entity\EntityPropertyUtil;
6
 */
7
8
namespace TheSportsDb\Entity;
9
10
/**
11
 * Utility class.
12
 *
13
 * @author Jelle Sebreghts
14
 */
15
class EntityPropertyUtil {
16
17
  /**
18
   * Get the raw value of any value.
19
   *
20
   * @param mixed $val
21
   *   The value to get the raw value of.
22
   *
23
   * @return mixed
24
   *   The raw value.
25
   */
26 1
  public static function getRawValue($val) {
27 1
    $return = $val;
28 1
    if (method_exists($val, 'raw')) {
29 1
      $return = $val->raw();
30
    }
31 1
    elseif (is_array($val)) {
32 1
      $return = array();
33 1
      foreach ($val as $v) {
34 1
        $return[] = method_exists($v, 'raw') ? $v->raw() : $v;
35
      }
36
    }
37 1
    return $return;
38
  }
39
}
40