Completed
Push — master ( 9a2061...9f070b )
by Andrii
06:46
created

YearPeriod   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 1
dl 0
loc 9
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A countPeriodsPassed() 0 6 1
1
<?php
2
/**
3
 * PHP Billing Library
4
 *
5
 * @link      https://github.com/hiqdev/php-billing
6
 * @package   php-billing
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2017-2018, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\php\billing\charge\modifiers\addons;
12
13
use DateTimeImmutable;
14
15
/**
16
 * Year Period addon.
17
 *
18
 * @author Andrii Vasyliev <[email protected]>
19
 */
20
class YearPeriod extends Period
21
{
22
    public function countPeriodsPassed(DateTimeImmutable $since, DateTimeImmutable $time)
23
    {
24
        $diff = $time->diff($since);
25
26
        return $diff->y / $this->value;
27
    }
28
}
29