Passed
Push — master ( c541cb...64a56e )
by Chris
33s
created

TicketReservationRequest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 36
ccs 0
cts 10
cp 0
rs 10
c 0
b 0
f 0
wmc 4
lcom 0
cbo 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 2
A getTicketType() 0 4 1
A getQuantity() 0 4 1
1
<?php
2
3
namespace ConferenceTools\Tickets\Domain\ValueObject;
4
5
class TicketReservationRequest
6
{
7
    private $ticketType;
8
    private $quantity;
9
10
    /**
11
     * TicketReservationRequest constructor.
12
     * @param $ticketType
13
     * @param $quantity
14
     */
15
    public function __construct(TicketType $ticketType, int $quantity)
16
    {
17
        if ($quantity < 1) {
18
            throw new \DomainException('Quantity must be greater than 0');
19
        }
20
21
        $this->ticketType = $ticketType;
22
        $this->quantity = $quantity;
23
    }
24
25
    /**
26
     * @return TicketType
27
     */
28
    public function getTicketType()
29
    {
30
        return $this->ticketType;
31
    }
32
33
    /**
34
     * @return int
35
     */
36
    public function getQuantity()
37
    {
38
        return $this->quantity;
39
    }
40
}