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.
Passed
Push — master ( 083d1a...28e483 )
by cao
03:15
created

ModelContainerBuilder   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 45
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 3

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A build() 0 4 1
A buildWithoutCache() 0 4 1
A createContainer() 0 4 1
1
<?php
2
3
namespace PhpBoot\ORM;
4
5
use DI\Container;
6
use DI\FactoryInterface;
7
use Doctrine\Common\Cache\Cache;
8
use PhpBoot\DI\DIContainerBuilder;
9
use PhpBoot\Entity\Annotations\ClassAnnotationHandler;
10
use PhpBoot\Entity\Annotations\PropertyAnnotationHandler;
11
use PhpBoot\Entity\Annotations\VarAnnotationHandler;
12
use PhpBoot\Entity\EntityContainerBuilder;
13
use PhpBoot\ORM\Annotations\PKAnnotationHandler;
14
use PhpBoot\ORM\Annotations\TableAnnotationHandler;
15
use DI\InvokerInterface as DIInvokerInterface;
16
17
class ModelContainerBuilder extends EntityContainerBuilder
18
{
19
    static $DEFAULT_ANNOTATIONS=[
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $DEFAULT_ANNOTATIONS.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
20
        [ClassAnnotationHandler::class, 'class'],
21
        [PKAnnotationHandler::class, "class.children[?name=='pk']"],
22
        [TableAnnotationHandler::class, "class.children[?name=='table']"],
23
        [PropertyAnnotationHandler::class, 'properties'],
24
        [VarAnnotationHandler::class, "properties.*.children[?name=='var'][]"],
25
        //[ValidateAnnotationHandler::class, "properties.*.children[?name=='".Names::VALIDATE."'][]"],
0 ignored issues
show
Unused Code Comprehensibility introduced by
54% 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...
26
    ];
27
28 10
    public function __construct(FactoryInterface $factory,
29
                                DIInvokerInterface $diInvoker,
30
                                Cache $cache)
31
    {
32 10
        $this->container = DIContainerBuilder::buildDevContainer();
0 ignored issues
show
Bug introduced by
The property container does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
33 10
        parent::__construct($factory, $diInvoker, $cache, self::$DEFAULT_ANNOTATIONS);
34 10
    }
35
    /**
36
     * load from class with local cache
37
     * @param string $className
38
     * @return ModelContainer
39
     */
40 10
    public function build($className)
41
    {
42 10
        return parent::build($className);
43
    }
44
45
    /**
46
     * @param $className
47
     * @return ModelContainer
48
     */
49 2
    public function buildWithoutCache($className)
50
    {
51 2
        return parent::buildWithoutCache($className);
52
    }
53
    /**
54
     * @param string $className
55
     * @return ModelContainer
56
     */
57 2
    protected function createContainer($className)
58
    {
59 2
        return $this->factory->make(ModelContainer::class, ['className'=>$className]);
60
    }
61
}