Passed
Push — master ( bcdf9c...292b00 )
by Luo
02:34
created

SignatureTrait::gmt_iso8601()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 1
dl 0
loc 9
ccs 0
cts 8
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Iidestiny\Flysystem\Oss\Traits;
4
5
use DateTime;
6
7
trait SignatureTrait
8
{
9
    /**
10
     * gmt
11
     *
12
     * @param $time
13
     *
14
     * @return string
15
     * @throws \Exception
16
     */
17
    function gmt_iso8601($time)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
18
    {
19
        $dtStr      = date("c", $time);
20
        $myDatetime = new DateTime($dtStr);
21
        $expiration = $myDatetime->format(DateTime::ISO8601);
22
        $pos        = strpos($expiration, '+');
23
        $expiration = substr($expiration, 0, $pos);
24
25
        return $expiration . "Z";
26
    }
27
}