Revealer   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 26
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A reveal() 0 16 4
1
<?php
2
3
/*
4
 * This file is part of the Prophecy.
5
 * (c) Konstantin Kudryashov <[email protected]>
6
 *     Marcello Duarte <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Prophecy\Prophecy;
13
14
/**
15
 * Basic prophecies revealer.
16
 *
17
 * @author Konstantin Kudryashov <[email protected]>
18
 */
19
class Revealer implements RevealerInterface
20
{
21
    /**
22
     * Unwraps value(s).
23
     *
24
     * @param mixed $value
25
     *
26
     * @return mixed
27
     */
28
    public function reveal($value)
29
    {
30
        if (is_array($value)) {
31
            return array_map(array($this, __FUNCTION__), $value);
32
        }
33
34
        if (!is_object($value)) {
35
            return $value;
36
        }
37
38
        if ($value instanceof ProphecyInterface) {
39
            $value = $value->reveal();
40
        }
41
42
        return $value;
43
    }
44
}
45