Completed
Push — master ( 0add47...c5c5d3 )
by Jelle
02:57
created

EntityPropertyUtil::getRawValue()   B

Complexity

Conditions 5
Paths 3

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 13
rs 8.8571
cc 5
eloc 9
nc 3
nop 1
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
  public static function getRawValue($val) {
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
18
    $return = $val;
19
    if (method_exists($val, 'raw')) {
20
      $return = $val->raw();
21
    }
22
    elseif (is_array($val)) {
23
      $return = array();
24
      foreach ($val as $v) {
25
        $return[] = method_exists($v, 'raw') ? $v->raw() : $v;
26
      }
27
    }
28
    return $return;
29
  }
30
}
31