Resource::getAmount()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace App\Entity;
4
5
class Resource
6
{
7
    /** @var int */
8
    private $amount = 0;
9
10
    /**
11
     * @return int
12
     */
13
    public function getAmount(): int
14
    {
15
        return $this->amount;
16
    }
17
18
    /**
19
     * Resource constructor.
20
     *
21
     * @param int $amount
22
     */
23
    public function __construct($amount)
24
    {
25
        $this->amount = $amount;
26
    }
27
28
    /**
29
     * Subtract resource amount.
30
     *
31
     * @param int $amount
32
     *
33
     * @return $this
34
     */
35
    public function subtract(int $amount)
36
    {
37
        $this->amount -= $amount;
38
39
        return $this;
40
    }
41
42
    /**
43
     * @return string
44
     */
45
    public function toString()
46
    {
47
        return (string) $this->amount;
48
    }
49
}
50