TwitterDates::formatToMysql()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 2
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 5
ccs 0
cts 4
cp 0
crap 6
rs 10
1
<?php
2
3
namespace Tequilarapido\Twit;
4
5
use Carbon\Carbon;
6
7
class TwitterDates
8
{
9
    /**
10
     * Parse twitter raw date.
11
     *
12
     * @param string $twitterDate
13
     *
14
     * @return Carbon|null
15
     */
16
    public static function parse($twitterDate)
17
    {
18
        return $twitterDate ? Carbon::createFromTimestamp(strtotime($twitterDate)) : null;
19
    }
20
21
    /**
22
     * Format twitter date to `Y-m-d H:i:s`.
23
     *
24
     * @param string $twitterDate
25
     * @return null
26
     */
27
    public static function formatToMysql($twitterDate)
28
    {
29
        $date = static::parseTwitterDate($twitterDate);
0 ignored issues
show
Bug introduced by
The method parseTwitterDate() does not exist on Tequilarapido\Twit\TwitterDates. ( Ignorable by Annotation )

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

29
        /** @scrutinizer ignore-call */ 
30
        $date = static::parseTwitterDate($twitterDate);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
30
31
        return $date ? $date->format('Y-m-d H:i:s') : null;
32
    }
33
}
34