Issues (18)

Utils/CardHelper.php (3 issues)

1
<?php
2
3
namespace Scrumban\Utils;
4
5
use Scrumban\Model\CardInterface;
6
7
class CardHelper
8
{
9
    public static function extractValue(string $extraData): int
10
    {
11
        if (strtoupper($extraData{0}) !== 'V') {
12
            return 0;
13
        }
14
        return (int) substr($extraData, 1, 3);
15
    }
16
    
17
    public static function extractEstimatedTime(string $cardTitle): int
0 ignored issues
show
The parameter $cardTitle is not used and could be removed. ( Ignorable by Annotation )

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

17
    public static function extractEstimatedTime(/** @scrutinizer ignore-unused */ string $cardTitle): int

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
18
    {
19
        return 0;
20
    }
21
    
22
    public static function extractSpentTime(string $cardTitle): int
0 ignored issues
show
The parameter $cardTitle is not used and could be removed. ( Ignorable by Annotation )

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

22
    public static function extractSpentTime(/** @scrutinizer ignore-unused */ string $cardTitle): int

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
23
    {
24
        return 0;
25
    }
26
    
27
    public static function extractCreationDate(string $cardId): \DateTime
28
    {
29
        return (new \DateTime())->setTimestamp(hexdec(substr($cardId, 0, 8)));
0 ignored issues
show
It seems like hexdec(substr($cardId, 0, 8)) can also be of type double; however, parameter $unixtimestamp of DateTime::setTimestamp() does only seem to accept integer, maybe add an additional type check? ( 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 \DateTime())->setTimestamp(/** @scrutinizer ignore-type */ hexdec(substr($cardId, 0, 8)));
Loading history...
30
    }
31
    
32
    public static function isInCurrentSprint(string $status): bool
33
    {
34
        return in_array($status, [
35
            CardInterface::STATUS_TODO,
36
            CardInterface::STATUS_IN_PROGRESS,
37
            CardInterface::STATUS_REVIEW,
38
            CardInterface::STATUS_TO_RELEASE
39
        ]);
40
    }
41
    
42
    public static function slugify($name)
43
    {
44
        return str_replace(' ', '_', strtolower($name));
45
    }
46
}