Quantity   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A create() 0 3 1
A getQuantity() 0 3 1
1
<?php
2
3
4
namespace Dolibarr\Client\Domain\Proposal;
5
6
use Webmozart\Assert\Assert;
7
8
final class Quantity
9
{
10
    /**
11
     * @var int
12
     */
13
    private $quantity;
14
15
    /**
16
     * @param int $quantity
17
     */
18
    private function __construct($quantity)
19
    {
20
        Assert::greaterThan($quantity, 0);
21
        Assert::integerish($quantity);
22
        $this->quantity = (int)$quantity;
23
    }
24
25
    /**
26
     * @param int $quantity
27
     *
28
     * @return Quantity
29
     */
30
    public static function create($quantity)
31
    {
32
        return new self($quantity);
33
    }
34
35
    /**
36
     * @return int
37
     */
38
    public function getQuantity()
39
    {
40
        return $this->quantity;
41
    }
42
}
43