Minutes   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 90
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 12
c 2
b 0
f 0
dl 0
loc 90
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A inMonths() 0 3 1
A inDays() 0 3 1
A inHours() 0 3 1
A inYears() 0 3 1
A inWeeks() 0 3 1
1
<?php
2
3
namespace SubjectivePHP\Durations;
4
5
abstract class Minutes
6
{
7
    /**
8
     * @var int
9
     */
10
    const ONE_MINUTE = 1;
11
12
    /**
13
     * @var int
14
     */
15
    const HOUR_IN_MINUTES = self::ONE_MINUTE * 60;
16
17
    /**
18
     * @var int
19
     */
20
    const DAY_IN_MINUTES = self::HOUR_IN_MINUTES * 24;
21
22
    /**
23
     * @var int
24
     */
25
    const WEEK_IN_MINUTES = self::DAY_IN_MINUTES * 7;
26
27
    /**
28
     * @var int
29
     */
30
    const MONTH_IN_MINUTES = self::DAY_IN_MINUTES * 30;
31
32
    /**
33
     * @var int
34
     */
35
    const YEAR_IN_MINUTES = self::DAY_IN_MINUTES * 365;
36
37
    /**
38
     * Returns the given number of hours represented in minutes.
39
     *
40
     * @param int $hours The value to covert to minutes.
41
     *
42
     * @return int
43
     */
44
    public static function inHours(int $hours) : int
45
    {
46
        return $hours * self::HOUR_IN_MINUTES;
47
    }
48
49
    /**
50
     * Returns the given number of days represented in minutes.
51
     *
52
     * @param int $days The value to covert to minutes.
53
     *
54
     * @return int
55
     */
56
    public static function inDays(int $days) : int
57
    {
58
        return $days * self::DAY_IN_MINUTES;
59
    }
60
61
    /**
62
     * Returns the given number of weeks represented in minutes.
63
     *
64
     * @param int $weeks The value to covert to minutes.
65
     *
66
     * @return int
67
     */
68
    public static function inWeeks(int $weeks) : int
69
    {
70
        return $weeks * self::WEEK_IN_MINUTES;
71
    }
72
73
    /**
74
     * Returns the given number of months represented in minutes.
75
     *
76
     * @param int $months The value to covert to minutes.
77
     *
78
     * @return int
79
     */
80
    public static function inMonths(int $months) : int
81
    {
82
        return $months * self::MONTH_IN_MINUTES;
83
    }
84
85
    /**
86
     * Returns the given number of years represented in minutes.
87
     *
88
     * @param int $years The value to covert to minutes.
89
     *
90
     * @return int
91
     */
92
    public static function inYears(int $years) : int
93
    {
94
        return $years * self::YEAR_IN_MINUTES;
95
    }
96
}
97