Passed
Push — master ( 79bf3c...52a24b )
by Alex
01:04 queued 13s
created

EntityManagerConfigs   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 6
c 1
b 0
f 0
dl 0
loc 42
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setEntityManagerConfig() 0 3 1
A hasEntityManagerConfig() 0 3 1
A getEntityManagerConfig() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Arp\LaminasDoctrine\Config;
6
7
/**
8
 * @author  Alex Patterson <[email protected]>
9
 * @package Arp\LaminasDoctrine\Config
10
 */
11
class EntityManagerConfigs
12
{
13
    /**
14
     * @var array<string, array<mixed>>
15
     */
16
    private array $configs;
17
18
    /**
19
     * @param array<mixed> $configs
20
     */
21
    public function __construct(array $configs)
22
    {
23
        $this->configs = $configs;
24
    }
25
26
    /**
27
     * @param string $name
28
     *
29
     * @return bool
30
     */
31
    public function hasEntityManagerConfig(string $name): bool
32
    {
33
        return isset($this->configs[$name]);
34
    }
35
36
    /**
37
     * @param string $name
38
     *
39
     * @return array<string, mixed>
40
     */
41
    public function getEntityManagerConfig(string $name): array
42
    {
43
        return $this->configs[$name] ?? [];
44
    }
45
46
    /**
47
     * @param string               $name
48
     * @param array<string, mixed> $config
49
     */
50
    public function setEntityManagerConfig(string $name, array $config): void
51
    {
52
        $this->configs[$name] = $config;
53
    }
54
}
55