TicketCounter::ticketsReleased()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace ConferenceTools\Tickets\Domain\ReadModel\TicketCounts;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use ConferenceTools\Tickets\Domain\ValueObject\TicketType;
7
8
/**
9
 * Class TicketCounter
10
 * @package ConferenceTools\Tickets\Domain\ReadModel\TicketCounts
11
 * @ORM\Entity()
12
 */
13
class TicketCounter
14
{
15
    /**
16
     * @var integer
17
     * @ORM\Id @ORM\GeneratedValue @ORM\Column(type="integer")
18
     */
19
    private $id;
0 ignored issues
show
introduced by
The private property $id is not used, and could be removed.
Loading history...
20
21
    /**
22
     * @var TicketType
23
     * @ORM\Embedded(class="ConferenceTools\Tickets\Domain\ValueObject\TicketType")
24
     */
25
    private $ticketType;
26
27
    /**
28
     * @var integer
29
     * @ORM\Column(type="integer")
30
     */
31
    private $remaining;
32
33
    /**
34
     * TicketCounter constructor.
35
     * @param TicketType $ticketType
36
     * @param int $remaining
37
     */
38 3
    public function __construct(TicketType $ticketType, int $remaining)
39
    {
40 3
        $this->ticketType = $ticketType;
41 3
        $this->remaining = $remaining;
42 3
    }
43
44
    /**
45
     * @return int
46
     */
47 13
    public function getRemaining()
48
    {
49 13
        return $this->remaining;
50
    }
51
52
    /**
53
     * @return TicketType
54
     */
55 11
    public function getTicketType()
56
    {
57 11
        return $this->ticketType;
58
    }
59
60 1
    public function ticketsReserved(int $number)
61
    {
62 1
        $this->remaining -= $number;
63 1
    }
64
65 1
    public function ticketsReleased(int $number)
66
    {
67 1
        $this->remaining += $number;
68
    }
69
}