DoctrinePluginConfiguration   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 22
ccs 8
cts 8
cp 1
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A isDevMode() 0 3 1
A getManagerConfiguration() 0 3 1
A getConnectionList() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 *  This file is part of the Micro framework package.
7
 *
8
 *  (c) Stanislau Komar <[email protected]>
9
 *
10
 *  For the full copyright and license information, please view the LICENSE
11
 *  file that was distributed with this source code.
12
 */
13
14
namespace Micro\Plugin\Doctrine;
15
16
use Micro\Framework\Kernel\Configuration\PluginConfiguration;
17
use Micro\Plugin\Doctrine\Configuration\EntityManagerConfiguration;
18
use Micro\Plugin\Doctrine\Configuration\EntityManagerConfigurationInterface;
19
20
class DoctrinePluginConfiguration extends PluginConfiguration implements DoctrinePluginConfigurationInterface
21
{
22
    public const CFG_CONNECTIONS = 'ORM_CONNECTION_LIST';
23
24
    /**
25
     * {@inheritDoc}
26
     */
27 1
    public function getConnectionList(): array
28
    {
29 1
        return $this->explodeStringToArray(
30 1
            $this->configuration->get(self::CFG_CONNECTIONS, self::MANAGER_DEFAULT)
31 1
        );
32
    }
33
34 2
    public function getManagerConfiguration(string $connectionName): EntityManagerConfigurationInterface
35
    {
36 2
        return new EntityManagerConfiguration($this->configuration, $connectionName);
37
    }
38
39 3
    public function isDevMode(): bool
40
    {
41 3
        return str_starts_with((string) $this->configuration->get('APP_ENV', 'dev'), 'dev');
42
    }
43
}
44