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.

BatchTime   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 14
dl 0
loc 52
rs 10
c 3
b 0
f 0
wmc 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __toString() 0 3 1
A getTime() 0 3 1
A toString() 0 3 2
A setTime() 0 3 1
A getSeconds() 0 10 2
A setDay() 0 3 2
A getDay() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * (c) Christian Gripp <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Core23\Form\Model;
13
14
use DateTime;
15
16
class BatchTime
17
{
18
    /**
19
     * @var int
20
     */
21
    private $day = 0;
22
23
    /**
24
     * @var DateTime|null
25
     */
26
    private $time;
27
28
    public function __toString()
29
    {
30
        return $this->toString();
31
    }
32
33
    public function toString(): string
34
    {
35
        return 'Day: '.$this->day.', Time: '.(null !== $this->time ? $this->time->format('H:i:s') : 'null');
36
    }
37
38
    public function getDay(): int
39
    {
40
        return $this->day;
41
    }
42
43
    public function setDay(?int $day): void
44
    {
45
        $this->day = $day ?: 0;
46
    }
47
48
    public function getTime(): ?DateTime
49
    {
50
        return $this->time;
51
    }
52
53
    public function setTime(?DateTime $time): void
54
    {
55
        $this->time = $time;
56
    }
57
58
    public function getSeconds(): int
59
    {
60
        $seconds =  $this->getDay() * 86400;
61
62
        if (null !== $this->getTime()) {
63
            $time = clone $this->getTime();
64
            $seconds += (int) $time->format('U');
65
        }
66
67
        return $seconds;
68
    }
69
}
70