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 ( 8c3ee0...d7f4ea )
by Hong
04:46
created

FactoryAwareTrait   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 4
c 1
b 0
f 1
lcom 1
cbo 1
dl 0
loc 39
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setFactory() 0 5 1
A getFactory() 0 10 2
A hasFactory() 0 4 1
1
<?php
2
/**
3
 * Phossa Project
4
 *
5
 * PHP version 5.4
6
 *
7
 * @category  Library
8
 * @package   Phossa2\Di
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\Di\Traits;
16
17
use Phossa2\Di\Message\Message;
18
use Phossa2\Di\Exception\NotFoundException;
19
use Phossa2\Di\Interfaces\FactoryInterface;
20
use Phossa2\Di\Interfaces\FactoryAwareInterface;
21
22
/**
23
 * FactoryAwareTrait
24
 *
25
 * Implementation of FactoryAwareInterface
26
 *
27
 * @package Phossa2\Di
28
 * @author  Hong Zhang <[email protected]>
29
 * @see     FactoryAwareInterface
30
 * @version 2.0.0
31
 * @since   2.0.0 added
32
 */
33
trait FactoryAwareTrait
34
{
35
    /**
36
     * @var    FactoryInterface
37
     * @access protected
38
     */
39
    protected $factory;
40
41
    /**
42
     * {@inheritDoc}
43
     */
44
    public function setFactory(FactoryInterface $factory)
45
    {
46
        $this->factory = $factory;
47
        return $this;
48
    }
49
50
    /**
51
     * {@inheritDoc}
52
     */
53
    public function getFactory()/*# : FactoryInterface */
54
    {
55
        if ($this->hasFactory()) {
56
            return $this->factory;
57
        }
58
        throw new NotFoundException(
59
            Message::get(Message::DI_FACTORY_NOTFOUND),
60
            Message::DI_FACTORY_NOTFOUND
61
        );
62
    }
63
64
    /**
65
     * {@inheritDoc}
66
     */
67
    public function hasFactory()/*# : bool */
68
    {
69
        return null !== $this->factory;
70
    }
71
}
72