Passed
Push — develop ( 0e0fcc...00fcbf )
by Alec
03:46 queued 01:09
created

carbon()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
ccs 1
cts 1
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * User: alec
4
 * Date: 12.10.18
5
 * Time: 14:18
6
 */
7
8
namespace AlecRabbit;
9
10
/**
11
 * Create a new Carbon instance for the current time.
12
 *
13
 * @param  \DateTimeZone|string|null $tz
14
 * @return \Carbon\Carbon
15
 * @throws \Exception
16
 */
17
function now($tz = null)
18
{
19 1
    return new \Carbon\Carbon(null, $tz);
20
}
21
22
/**
23
 * @param string|null               $time
24
 * @param \DateTimeZone|string|null $tz
25
 * @return \Carbon\Carbon
26
 * @throws \Exception
27
 */
28
function carbon($time = null, $tz = null)
29
{
30 1
    return new \Carbon\Carbon($time, $tz);
31
}
32
33
/**
34
 * Calculate timestamp of start of interval.
35
 *
36
 * @param int $timestamp
37
 * @param int $interval
38
 * @return int
39
 */
40
function base_timestamp(int $timestamp, int $interval = 60): int
41
{
42 11
    return \intdiv($timestamp, $interval) * $interval;
43
}
44