Quantity::getQuantity()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
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