WeekDaysSpan::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
namespace CL\DateUtils;
4
5
use DateTime;
6
7
/**
8
 * Force week days.
9
 *
10
 * @author    Ivan Kerin <[email protected]>
11
 * @copyright 2015, Clippings Ltd.
12
 * @license   http://spdx.org/licenses/BSD-3-Clause
13
 */
14
class WeekDaysSpan extends DaysSpan
15
{
16 1
    public function __construct(WeekDays $from, WeekDays $to)
17
    {
18 1
        parent::__construct($from, $to);
19 1
    }
20
21
    /**
22
     * @return string
23
     */
24 3
    public function humanize()
25
    {
26 3
        if ($this->getFrom()->getDays() == $this->getTo()->getDays()) {
27 1
            return $this->getFrom()->getDays().' week days';
28
        }
29
30 2
        return $this->getFrom()->getDays().' - '.$this->getTo()->getDays().' week days';
31
    }
32
}
33