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

Package::__construct()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 1
nop 1
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
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
}