Holiday   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 78.56%

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 18
c 1
b 1
f 0
dl 0
loc 41
ccs 11
cts 14
cp 0.7856
rs 10
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 27 4
1
<?php
2
3
namespace Andreshg112\HolidaysPhp;
4
5
use Jenssegers\Date\Date;
6
7
class Holiday
8
{
9
    /** @var string */
10
    public $country;
11
12
    /** @var \Jenssegers\Date\Date */
13
    public $date;
14
15
    /** @var string */
16
    public $title;
17
18
    /** @var string */
19
    public $language;
20
21 2
    public function __construct(string $country, Date $date, string $title, string $language)
22
    {
23 2
        $country = trim($country);
24
25 2
        if (empty($country)) {
26
            throw HolidaysPhpException::notEmptyCountry();
27
        }
28
29 2
        $title = trim($title);
30
31 2
        if (empty($title)) {
32
            throw HolidaysPhpException::notEmptyTitle();
33
        }
34
35 2
        $language = trim($language);
36
37 2
        if (empty($language)) {
38
            throw HolidaysPhpException::notEmptyLanguage();
39
        }
40
41 2
        $this->country = $country;
42
43 2
        $this->date = $date->setTime(0, 0);
44
45 2
        $this->title = $title;
46
47 2
        $this->language = $language;
48 2
    }
49
}
50