GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Currency   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 45
ccs 11
cts 11
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 2
A getCode() 0 4 1
A equals() 0 4 1
A __toString() 0 4 1
1
<?php
2
3
namespace WSW\Money;
4
5
use InvalidArgumentException;
6
7
/**
8
 * Class Currency
9
 *
10
 * @package WSW\Money
11
 * @author Ronaldo Matos Rodrigues <[email protected]>
12
 */
13
final class Currency
14
{
15
    /**
16
     * @var string
17
     */
18
    private $code;
19
20
    /**
21
     * @param string $code
22
     */
23 24
    public function __construct($code)
24
    {
25 24
        if (!is_string($code)) {
26 1
            throw new InvalidArgumentException('Currency code should be string');
27
        }
28
29 23
        $this->code = $code;
30 23
    }
31
32
    /**
33
     * @return string
34
     */
35 12
    public function getCode()
36
    {
37 12
        return $this->code;
38
    }
39
40
    /**
41
     * @param Currency $other
42
     *
43
     * @return bool
44
     */
45 9
    public function equals(Currency $other)
46
    {
47 9
        return ($this->getCode() === $other->getCode());
48
    }
49
50
    /**
51
     * @return string
52
     */
53 1
    public function __toString()
54
    {
55 1
        return $this->getCode();
56
    }
57
}
58