Passed
Pull Request — master (#102)
by
unknown
02:26
created

Representation::getSql()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php declare(strict_types=1);
2
3
namespace hiqdev\php\billing\product\invoice;
4
5
use hiqdev\php\billing\type\TypeInterface;
0 ignored issues
show
Bug introduced by
The type hiqdev\php\billing\type\TypeInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
7
/**
8
 * This class is made abstract intentionally.
9
 * Because you can attach multiple representations, and thus you should distinguish them somehow.
10
 * So, please implement you own representation.
11
 */
12
abstract class Representation implements RepresentationInterface
13
{
14
    private TypeInterface $type;
15
16
    public function __construct(private readonly string $sql)
17
    {
18
        if (trim($this->sql) === '') {
19
            throw new InvalidRepresentationException('Representation SQL cannot be empty.');
20
        }
21
    }
22
23
    public function getSql(): string
24
    {
25
        return $this->sql;
26
    }
27
28
    public function setType(TypeInterface $type): RepresentationInterface
29
    {
30
        $this->type = $type;
31
32
        return $this;
33
    }
34
35
    public function getType(): TypeInterface
36
    {
37
        return $this->type;
38
    }
39
}
40