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 ( ab4a69...9ba762 )
by Ross
10:41 queued 10:38
created

BuilderContainer   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 9
eloc 21
dl 0
loc 73
ccs 0
cts 44
cp 0
rs 10
c 0
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A setDbHost() 0 5 1
A setDbPass() 0 5 1
A setEnvFilePath() 0 5 1
A getBuilder() 0 8 1
A setDbUser() 0 5 1
A setDbName() 0 5 1
A setDbConfig() 0 7 2
A getContainer() 0 8 1
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\Builder;
4
5
use EdmondsCommerce\DoctrineStaticMeta\Config;
6
use EdmondsCommerce\DoctrineStaticMeta\Container;
7
use EdmondsCommerce\DoctrineStaticMeta\SimpleEnv;
8
use Symfony\Component\DependencyInjection\ContainerBuilder;
9
10
/**
11
 * Class BuilderContainer
12
 *
13
 * @package EdmondsCommerce\DoctrineStaticMeta\Builder
14
 * @SuppressWarnings(PHPMD.Superglobals)
15
 * @SuppressWarnings(PHPMD.StaticAccess)
16
 */
17
class BuilderContainer
18
{
19
20
    public function setEnvFilePath(string $envPath): self
21
    {
22
        SimpleEnv::setEnv($envPath);
23
24
        return $this;
25
    }
26
27
    public function setDbName(string $dbName): self
28
    {
29
        $_SERVER[Config::PARAM_DB_NAME] = $dbName;
30
31
        return $this;
32
    }
33
34
    public function setDbUser(string $dbUser): self
35
    {
36
        $_SERVER[Config::PARAM_DB_USER] = $dbUser;
37
38
        return $this;
39
    }
40
41
    public function setDbPass(string $dbPass): self
42
    {
43
        $_SERVER[Config::PARAM_DB_PASS] = $dbPass;
44
45
        return $this;
46
    }
47
48
    public function setDbHost(string $dbHost): self
49
    {
50
        $_SERVER[Config::PARAM_DB_HOST] = $dbHost;
51
52
        return $this;
53
    }
54
55
    public function setDbConfig(array $config): self
56
    {
57
        foreach ($config as $key => $value) {
58
            $_SERVER[$key] = $value;
59
        }
60
61
        return $this;
62
    }
63
64
    /**
65
     * @return ContainerBuilder
66
     * @SuppressWarnings(PHPMD)
67
     */
68
    public function getContainer(): ContainerBuilder
69
    {
70
        $containerBuilder = new ContainerBuilder();
71
        $containerBuilder->autowire(Builder::class)->setPublic(true);
72
        (new Container())->addConfiguration($containerBuilder, $_SERVER);
73
        $containerBuilder->compile();
74
75
        return $containerBuilder;
76
    }
77
78
    /**
79
     * @return Builder
80
     * @throws \Exception
81
     */
82
    public function getBuilder(): Builder
83
    {
84
        /**
85
         * @var Builder
86
         */
87
        $builder = $this->getContainer()->get(Builder::class);
88
89
        return $builder;
90
    }
91
}
92