Completed
Push — master ( b3e533...24297e )
by Nekrasov
30s queued 12s
created

NamespacesRepository::getNamespace()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
c 0
b 0
f 0
rs 10
cc 2
nc 2
nop 1
1
<?php
2
3
namespace Arrilot\Widgets;
4
5
use Arrilot\Widgets\Misc\NamespaceNotFoundException;
6
7
class NamespacesRepository
8
{
9
    /**
10
     * The array of namespaces.
11
     *
12
     * @var array
13
     */
14
    protected $namespaces;
15
16
    /**
17
     * Register a namespace.
18
     *
19
     * @param string $alias
20
     * @param string $namespace
21
     *
22
     * @return WidgetNamespaces
23
     */
24
    public function registerNamespace($alias, $namespace)
25
    {
26
        $this->namespaces[$alias] = rtrim($namespace, '\\');
27
28
        return $this;
29
    }
30
31
    /**
32
     * Get namespace by his alias.
33
     *
34
     * @param string $label
0 ignored issues
show
Bug introduced by
There is no parameter named $label. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
35
     *
36
     * @throws \Exception
37
     *
38
     * @return string
39
     */
40
    public function getNamespace($alias)
41
    {
42
        if (!isset($this->namespaces[$alias])) {
43
            throw new NamespaceNotFoundException('Namespace not found with the alias "'.$alias.'"');
44
        }
45
46
        return $this->namespaces[$alias];
47
    }
48
}
49