DmsDatabase::getDmsTables()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace Janisbiz\LightOrm\Dms\MySQL\Generator\Dms;
4
5
use Janisbiz\LightOrm\Generator\Dms\DmsDatabaseInterface;
6
use Janisbiz\LightOrm\Generator\Dms\DmsTableInterface;
7
8
class DmsDatabase implements DmsDatabaseInterface
9
{
10
    /**
11
     * @var string
12
     */
13
    protected $name;
14
15
    /**
16
     * @var DmsTableInterface[]
17
     */
18
    protected $dmsTables = [];
19
20
    /**
21
     * @param string $name
22
     * @param DmsTableInterface[] $dmsTables
23
     */
24
    public function __construct(string $name, array $dmsTables)
25
    {
26
        $this->name = $name;
27
        $this->dmsTables = $dmsTables;
28
    }
29
30
    /**
31
     * @return string
32
     */
33
    public function getName(): string
34
    {
35
        return $this->name;
36
    }
37
38
    /**
39
     * @return string
40
     */
41
    public function getPhpName(): string
42
    {
43
        return \ucfirst(\preg_replace_callback(
44
            '/[^a-z0-9]+(?<name>\w{1})/i',
45
            function ($matches) {
46
                return \strtoupper($matches['name']);
47
            },
48
            $this->getName()
49
        ));
50
    }
51
52
    /**
53
     * @return DmsTableInterface[]
54
     */
55
    public function getDmsTables(): array
56
    {
57
        return $this->dmsTables;
58
    }
59
}
60