Completed
Push — master ( 3ecef8...f4e855 )
by Patrick
21:37
created

ApiKey::setVcode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
namespace Tarioch\EveapiFetcherBundle\Entity;
3
4
use Doctrine\ORM\Mapping as ORM;
5
use Doctrine\Common\Collections\ArrayCollection;
6
7
/**
8
 * @ORM\Entity(repositoryClass="ApiKeyRepository")
9
 * @ORM\Table(name="apiKey")
10
 */
11
class ApiKey
12
{
13
    /**
14
     * @ORM\Id @ORM\Column(name="keyID", type="bigint", options={"unsigned"=true})
15
     */
16
    private $keyId;
17
18
    /**
19
     * @ORM\Column(name="vCode", type="string")
20
     */
21
    private $vCode;
22
23
    /**
24
     * @ORM\Column(name="active", type="boolean")
25
     */
26
    private $active;
27
28
    /**
29
     * @ORM\Column(name="errorCount", type="integer")
30
     */
31
    private $errorCount;
32
33
    /**
34
     * @ORM\OneToMany(targetEntity="ApiCall", mappedBy="key")
35
     */
36
    private $apiCalls;
37
38
    public function __construct($keyId, $vCode)
39
    {
40
        $this->keyId = $keyId;
41
        $this->vCode = $vCode;
42
        $this->apiCalls = new ArrayCollection();
43
        $this->active = true;
44
        $this->errorCount = 0;
45
    }
46
47
    public function getKeyId()
48
    {
49
        return $this->keyId;
50
    }
51
52
    public function getVcode()
53
    {
54
        return $this->vCode;
55
    }
56
57
    public function setVcode($vcode)
58
    {
59
        $this->vCode = $vcode;
60
    }
61
62
    public function isActive()
63
    {
64
        return $this->active;
65
    }
66
67
    public function setActive($active)
68
    {
69
        $this->active = $active;
70
    }
71
72
    public function getErrorCount()
73
    {
74
        return $this->errorCount;
75
    }
76
77
    public function increaseErrorCount()
78
    {
79
        $this->errorCount++;
80
    }
81
82
    public function clearErrorCount()
83
    {
84
        $this->errorCount = 0;
85
    }
86
87
    public function getApiCalls()
88
    {
89
        return $this->apiCalls;
90
    }
91
}
92