Completed
Push — master ( 156cbf...ec5f3d )
by Frederick
14s
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
dl 0
loc 7
c 0
b 0
f 0
rs 9.4285
cc 2
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace Vanbrabantf\NpmStatFetcher\Package;
4
5
class Package
6
{
7
    /**
8
     * @var string
9
     */
10
    private $name;
11
12
    /**
13
     * @param string $name
14
     * @throws EmptyValueException
15
     */
16
    public function __construct(string $name)
17
    {
18
        if(empty($name)) {
19
            throw new EmptyValueException('Package name can\'t be empty');
20
        }
21
22
        $this->name = $name;
23
    }
24
25
    public function __toString()
26
    {
27
        return $this->name;
28
    }
29
}
30