GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — develop ( ed81f3...cf83d8 )
by Gabriel
05:44
created

LeagueContainer::getAlias()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
cc 3
eloc 6
nc 3
nop 1
dl 0
loc 10
ccs 0
cts 6
cp 0
crap 12
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Nip\Container\Bridges;
4
5
use League\Container\Container as Container;
6
use LogicException;
7
use Nip\Container\Traits\ContainerArrayAccessTrait;
8
9
/**
10
 * Class LeagueContainer
11
 * @package Nip\Container\Bridges
12
 */
13
abstract class LeagueContainer extends Container implements BridgeInterface
14
{
15
16
    /**
17
     * The registered type aliases.
18
     *
19
     * @var array
20
     */
21
    protected $aliases = [];
22
23
    use ContainerArrayAccessTrait;
24
25
    /**
26
     * @inheritdoc
27
     */
28 1
    public function set($alias, $concrete = null, $share = false)
29
    {
30 1
        return $this->add($alias, $concrete, $share);
31
    }
32
33
    /**
34
     * @inheritdoc
35
     */
36
    public function remove($alias)
37
    {
38
    }
39
40
    /**
41
     * Determine if a given string is an alias.
42
     *
43
     * @param  string $name
44
     * @return bool
45
     */
46
    public function isAlias($name)
47
    {
48
        return isset($this->aliases[$name]);
49
    }
50
51
    /**
52
     * Alias a type to a different name.
53
     *
54
     * @param  string $abstract
55
     * @param  string $alias
56
     * @return void
57
     */
58 1
    public function alias($abstract, $alias)
59
    {
60 1
        $this->aliases[$alias] = $abstract;
61
//        $this->abstractAliases[$abstract][] = $alias;
0 ignored issues
show
Unused Code Comprehensibility introduced by
65% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
62
63 1
        $this->share($alias, function () use ($abstract) {
64 1
            return $this->get($abstract);
65 1
        });
66 1
    }
67
68
    /**
69
     * Get the alias for an abstract if available.
70
     *
71
     * @param  string $abstract
72
     * @return string
73
     *
74
     * @throws \LogicException
75
     */
76
    public function getAlias($abstract)
77
    {
78
        if (!isset($this->aliases[$abstract])) {
79
            return $abstract;
80
        }
81
        if ($this->aliases[$abstract] === $abstract) {
82
            throw new LogicException("[{$abstract}] is aliased to itself.");
83
        }
84
        return $this->getAlias($this->aliases[$abstract]);
85
    }
86
}
87