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

PgObjectRefBase   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 29
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getSchemaName() 0 3 1
A getName() 0 3 1
A fromUnqualifiedName() 0 3 1
A __construct() 0 4 1
A fromQualifiedName() 0 3 1
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