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

PgObjectSignatureRefBase   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 24
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getArgTypes() 0 3 1
A fromQualifiedName() 0 5 1
A fromUnqualifiedName() 0 5 1
1
<?php
2
declare(strict_types=1);
3
namespace Ivory\Value;
4
5
/**
6
 * Reference to a PostgreSQL object by its signature.
7
 */
8
abstract class PgObjectSignatureRefBase extends PgObjectRefBase
9
{
10
    private $argTypes;
11
12
    public static function fromUnqualifiedName(string $name, PgTypeRef ...$argTypes)
13
    {
14
        $ref = new static(null, $name);
15
        $ref->argTypes = $argTypes;
16
        return $ref;
17
    }
18
19
    public static function fromQualifiedName(?string $schemaName, string $name, PgTypeRef ...$argTypes)
20
    {
21
        $ref = new static($schemaName, $name);
22
        $ref->argTypes = $argTypes;
23
        return $ref;
24
    }
25
26
    /**
27
     * @return PgTypeRef[] list of argument types
28
     */
29
    final public function getArgTypes(): array
30
    {
31
        return $this->argTypes;
32
    }
33
}
34