Revealer::reveal()   A
last analyzed

Complexity

Conditions 4
Paths 4

Size

Total Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 16
rs 9.7333
c 0
b 0
f 0
cc 4
nc 4
nop 1
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