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::__toString()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 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