Completed
Push — master ( 5309e4...b64411 )
by Frederick
12s
created

Package   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __toString() 0 3 1
A __construct() 0 7 2
1
<?php
2
3
namespace Vanbrabantf\NpmStatFetcher\ValueObjects;
4
5
use Vanbrabantf\NpmStatFetcher\Exceptions\EmptyValueException;
6
7
class Package
8
{
9
    /**
10
     * @var string
11
     */
12
    private $name;
13
14
    /**
15
     * @param string $name
16
     * @throws EmptyValueException
17
     */
18
    public function __construct(string $name)
19
    {
20
        if(empty($name)) {
21
           throw new EmptyValueException('Package name can\'t be empty');
22
        }
23
24
        $this->name = $name;
25
    }
26
27
    public function __toString()
28
    {
29
        return $this->name;
30
    }
31
}