Completed
Push — 1.x ( c183a4...05b51a )
by Alexander
8s
created

NamespacedReflectionFunction::getNamespaceName()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6
Metric Value
dl 0
loc 8
ccs 0
cts 7
cp 0
rs 9.4285
cc 2
eloc 4
nc 2
nop 0
crap 6
1
<?php
2
/*
3
 * Go! AOP framework
4
 *
5
 * @copyright Copyright 2013, Lisachenko Alexander <[email protected]>
6
 *
7
 * This source file is subject to the license that is bundled
8
 * with this source code in the file LICENSE.
9
 */
10
11
namespace Go\Aop\Support;
12
13
use ReflectionFunction;
14
15
/**
16
 * Namespaced version of global functions
17
 */
18
class NamespacedReflectionFunction extends ReflectionFunction
19
{
20
    /**
21
     * Custom namespace name
22
     *
23
     * @var string
24
     */
25
    private $namespace = '';
26
27
    /**
28
     * Extends the logic with passing the namespace name
29
     *
30
     * @param string $namespace Name of the namespace
31
     * {@inheritDoc}
32
     */
33
    public function __construct($name, $namespace = '')
34
    {
35
        $this->namespace = $namespace;
36
        parent::__construct($name);
37
    }
38
39
    /**
40
     * {@inheritDoc}
41
     */
42
    public function getNamespaceName()
43
    {
44
        if ($this->namespace) {
45
            return $this->namespace;
46
        }
47
48
        return parent::getNamespaceName();
49
    }
50
}
51