Completed
Push — master ( a7e110...90712e )
by Andrii
02:38
created

Type::equals()   A

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 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 * PHP Billing Library
4
 *
5
 * @link      https://github.com/hiqdev/php-billing
6
 * @package   php-billing
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\php\billing;
12
13
/**
14
 * Resource Type.
15
 *
16
 * @author Andrii Vasyliev <[email protected]>
17
 */
18
class Type implements TypeInterface
19
{
20
    /**
21
     * @var integer
22
     */
23
    public $id;
24
25
    /**
26
     * @var string
27
     */
28
    public $name;
29
30 3
    public function __construct($name)
31
    {
32 3
        $this->name = $name;
33 3
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38 2
    public function getName()
39
    {
40 2
        return $this->name;
41
    }
42
43
    /**
44
     * @return string
45
     */
46 2
    public function equals(TypeInterface $other)
47
    {
48 2
        return $this->name === $other->getName();
49
    }
50
}
51