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 — master ( 913970...1487d1 )
by Hong
04:43
created

ChainingTrait::delegatedGet()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 13
rs 9.4285
cc 3
eloc 9
nc 3
nop 1
1
<?php
2
/**
3
 * Phossa Project
4
 *
5
 * PHP version 5.4
6
 *
7
 * @category  Library
8
 * @package   Phossa2\Config
9
 * @copyright Copyright (c) 2016 phossa.com
10
 * @license   http://mit-license.org/ MIT License
11
 * @link      http://www.phossa.com/
12
 */
13
/*# declare(strict_types=1); */
14
15
namespace Phossa2\Config\Traits;
16
17
use Phossa2\Config\Interfaces\ChainingInterface;
18
use Phossa2\Shared\Delegator\DelegatorAwareTrait;
19
20
/**
21
 * ChainingTrait
22
 *
23
 * @package Phossa2\Config
24
 * @author  Hong Zhang <[email protected]>
25
 * @see     ChainingInterface
26
 * @version 2.0.7
27
 * @since   2.0.7 added
28
 */
29
trait ChainingTrait
30
{
31
    use DelegatorAwareTrait;
32
33
    /**
34
     * {@inheritDoc}
35
     */
36
    public function delegatedGet(/*# string */ $id)
37
    {
38
        if ($this->hasDelegator()) {
39
            $delegator = $this->getDelegator();
40
            if ($delegator instanceof ChainingInterface) {
41
                return $delegator->delegatedGet($id);
42
            } else {
43
                return $delegator->get($id);
44
            }
45
        } else {
46
            return $this->get($id);
0 ignored issues
show
Bug introduced by
It seems like get() must be provided by classes using this trait. How about adding it as abstract method to this trait?

This check looks for methods that are used by a trait but not required by it.

To illustrate, let’s look at the following code example

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). If this method does not exist on a class mixing in this trait, the method will fail.

Adding the getId() as an abstract method to the trait will make sure it is available.

Loading history...
47
        }
48
    }
49
}
50