Completed
Push — master ( 9087e5...42595d )
by Alec
03:55
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 1
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 mixed ...$args
24
 * @return \Carbon\Carbon
25
 * @throws \Exception
26
 */
27
function carbon(...$args)
28
{
29 1
    return new \Carbon\Carbon(...$args);
0 ignored issues
show
Bug introduced by
$args is expanded, but the parameter $time of Carbon\Carbon::__construct() does not expect variable arguments. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

29
    return new \Carbon\Carbon(/** @scrutinizer ignore-type */ ...$args);
Loading history...
30
}
31
32
/**
33
 * Calculate timestamp of start of interval.
34
 *
35
 * @param int $timestamp
36
 * @param int $interval
37
 * @return int
38
 */
39
function base_timestamp(int $timestamp, int $interval = 60): int
40
{
41 11
    return \intdiv($timestamp, $interval) * $interval;
42
}
43