Passed
Push — master ( 5e09ea...fc5aaf )
by Ondřej
03:46
created

PgObjectRefBase::getName()   A

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
2
declare(strict_types=1);
3
namespace Ivory\Value;
4
5
/**
6
 * Reference to a named PostgreSQL object.
7
 */
8
abstract class PgObjectRefBase
9
{
10
    private $schemaName;
11
    private $name;
12
13
    public static function fromUnqualifiedName(string $name)
14
    {
15
        return new static(null, $name);
16
    }
17
18
    public static function fromQualifiedName(?string $schemaName, string $name)
19
    {
20
        return new static($schemaName, $name);
21
    }
22
23
    final protected function __construct(?string $schemaName, string $name)
24
    {
25
        $this->schemaName = $schemaName;
26
        $this->name = $name;
27
    }
28
29
    final public function getSchemaName(): ?string
30
    {
31
        return $this->schemaName;
32
    }
33
34
    final public function getName(): string
35
    {
36
        return $this->name;
37
    }
38
}
39