GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Test Failed
Pull Request — master (#20)
by Grisha
05:21 queued 03:21
created

DateTrait::getDateTime()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * This file is part of Poloniex PHP SDK.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 *
8
 * @copyright 2017-2018 Chasovskih Grisha <[email protected]>
9
 * @license https://github.com/signulls/poloniex-php-sdk/blob/master/LICENSE MIT
10
 */
11
12
namespace Poloniex\Response\Traits;
13
14
use DateTime;
15
use Poloniex\Response\ResponseInterface;
16
17
/**
18
 * Trait DateTrait
19
 *
20
 * @author Grisha Chasovskih <[email protected]>
21
 */
22
trait DateTrait
23
{
24
    /**
25
     * Example: "2014-10-18 23:03:21"
26
     *
27
     * @var string
28
     */
29
    public $date;
30
31
    /**
32
     * @internal
33
     * @param string $date
34
     */
35
    public function setDate(string $date): void
36
    {
37
        $this->date = $date;
38
    }
39
40
    /**
41
     * @internal
42
     * @param null $format
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $format is correct as it would always require null to be passed?
Loading history...
43
     * @return string
44
     */
45
    public function getDate($format = null): string
46
    {
47
        return $format
0 ignored issues
show
introduced by
$format is of type null, thus it always evaluated to false.
Loading history...
48
            ? $this->getDateTime()->format($format)
49
            : $this->date;
50
    }
51
52
    /**
53
     * @return DateTime
54
     */
55
    public function getDateTime(): DateTime
56
    {
57
        return DateTime::createFromFormat(ResponseInterface::DATE_FORMAT, $this->date);
0 ignored issues
show
Bug Best Practice introduced by
The expression return DateTime::createF...TE_FORMAT, $this->date) could return the type false which is incompatible with the type-hinted return DateTime. Consider adding an additional type-check to rule them out.
Loading history...
58
    }
59
}