Resource   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 45
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getAmount() 0 4 1
A __construct() 0 4 1
A subtract() 0 6 1
A toString() 0 4 1
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