Backend   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 72
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 17
c 1
b 0
f 0
dl 0
loc 72
rs 10
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 3 1
A getToken() 0 3 1
A setType() 0 5 1
A setDomain() 0 5 1
A getType() 0 3 1
A getDomain() 0 3 1
A setToken() 0 5 1
1
<?php
2
3
namespace App\Document;
4
5
use Doctrine\Bundle\MongoDBBundle\Validator\Constraints\Unique as MongoDBUnique;
6
use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB;
7
use Symfony\Component\Serializer\Annotation\Groups;
8
use Symfony\Component\Validator\Constraints as Assert;
9
10
/**
11
 * @MongoDB\Document(repositoryClass="App\Repositories\BackendRepository")
12
 * @MongoDBUnique(fields="domain")
13
 */
14
class Backend
15
{
16
    const TYPE_GITLAB = 'gitlab';
17
    const TYPE_GITHUB = 'github';
18
19
    /**
20
     * @MongoDB\Id
21
     * @Groups({"backend_default", "backend_full"})
22
     */
23
    protected $id;
24
25
    /**
26
     * @MongoDB\Field(type="string")
27
     * @Assert\Choice({Backend::TYPE_GITHUB, Backend::TYPE_GITLAB})
28
     * @Assert\NotBlank
29
     * @Groups({"backend_default", "backend_full", "backend_write"})
30
     */
31
    protected $type;
32
33
    /**
34
     * @MongoDB\Field(type="string")
35
     * @Assert\NotBlank
36
     * @Groups({"backend_default", "backend_full", "backend_write"})
37
     */
38
    protected $domain;
39
40
    /**
41
     * @MongoDB\Field(type="string")
42
     * @Assert\NotBlank
43
     * @Groups({"backend_full", "backend_write"})
44
     */
45
    protected $token;
46
47
    public function getId(): string
48
    {
49
        return $this->id;
50
    }
51
52
    public function getType(): string
53
    {
54
        return $this->type;
55
    }
56
57
    public function setType(string $type): self
58
    {
59
        $this->type = $type;
60
61
        return $this;
62
    }
63
64
    public function getDomain(): string
65
    {
66
        return $this->domain;
67
    }
68
69
    public function setDomain(string $domain): self
70
    {
71
        $this->domain = $domain;
72
73
        return $this;
74
    }
75
76
    public function getToken(): string
77
    {
78
        return $this->token;
79
    }
80
81
    public function setToken(string $token): self
82
    {
83
        $this->token = $token;
84
85
        return $this;
86
    }
87
}
88