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

SignatureTrait   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 19
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A gmt_iso8601() 0 9 1
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
}