Passed
Push — dev ( 117aec...fd7324 )
by Janko
15:18
created

UserLayer::getLayer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stu\Orm\Entity;
6
7
use Doctrine\ORM\Mapping\Column;
8
use Doctrine\ORM\Mapping\Entity;
9
use Doctrine\ORM\Mapping\Id;
10
use Doctrine\ORM\Mapping\JoinColumn;
11
use Doctrine\ORM\Mapping\ManyToOne;
12
use Doctrine\ORM\Mapping\Table;
13
use Override;
0 ignored issues
show
Bug introduced by
The type Override 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...
14
use Stu\Component\Map\MapEnum;
0 ignored issues
show
Bug introduced by
The type Stu\Component\Map\MapEnum 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...
15
use Stu\Orm\Repository\UserLayerRepository;
16
17
#[Table(name: 'stu_user_layer')]
18
#[Entity(repositoryClass: UserLayerRepository::class)]
19
class UserLayer implements UserLayerInterface
20
{
21
    #[Column(type: 'smallint')]
22
    private int $map_type = MapEnum::MAPTYPE_INSERT;
23
24
    #[Id]
25
    #[ManyToOne(targetEntity: 'User')]
26
    #[JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
27
    private UserInterface $user;
28
29
    #[Id]
30
    #[ManyToOne(targetEntity: 'Layer')]
31
    #[JoinColumn(name: 'layer_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
32
    private LayerInterface $layer;
33
34
    #[Override]
35
    public function getUser(): UserInterface
36
    {
37
        return $this->user;
38
    }
39
40
    #[Override]
41
    public function setUser(UserInterface $user): UserLayerInterface
42
    {
43
        $this->user = $user;
44
45
        return $this;
46
    }
47
48
    #[Override]
49
    public function getLayer(): LayerInterface
50
    {
51
        return $this->layer;
52
    }
53
54
    #[Override]
55
    public function setLayer(LayerInterface $layer): UserLayerInterface
56
    {
57
        $this->layer = $layer;
58
59
        return $this;
60
    }
61
62 4
    #[Override]
63
    public function getMappingType(): int
64
    {
65 4
        return $this->map_type;
66
    }
67
68
    #[Override]
69
    public function setMappingType(int $mappingType): UserLayerInterface
70
    {
71
        $this->map_type = $mappingType;
72
73
        return $this;
74
    }
75
76 4
    public function isExplored(): bool
77
    {
78 4
        return $this->getMappingType() === MapEnum::MAPTYPE_LAYER_EXPLORED;
79
    }
80
}
81