TimeIntervalAware   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 21
ccs 0
cts 15
cp 0
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A humanizeTime() 0 9 2
A getBegin() 0 3 1
A getEnd() 0 3 1
1
<?php
2
3
/**
4
 * This file is part of RussianPost SDK package.
5
 *
6
 * © Appwilio (http://appwilio.com), JhaoDa (https://github.com/jhaoda)
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
declare(strict_types=1);
13
14
namespace Appwilio\RussianPostSDK\Dispatching\Endpoints\PostOffices\Responses;
15
16
trait TimeIntervalAware
17
{
18
    public function getBegin(): ?string
19
    {
20
        return $this->humanizeTime($this->getBeginValue());
0 ignored issues
show
Bug introduced by
The method getBeginValue() does not exist on Appwilio\RussianPostSDK\...onses\TimeIntervalAware. Did you maybe mean getBegin()? ( Ignorable by Annotation )

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

20
        return $this->humanizeTime($this->/** @scrutinizer ignore-call */ getBeginValue());

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...
21
    }
22
23
    public function getEnd(): ?string
24
    {
25
        return $this->humanizeTime($this->getEndValue());
0 ignored issues
show
Bug introduced by
The method getEndValue() does not exist on Appwilio\RussianPostSDK\...onses\TimeIntervalAware. Did you maybe mean getEnd()? ( Ignorable by Annotation )

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

25
        return $this->humanizeTime($this->/** @scrutinizer ignore-call */ getEndValue());

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...
26
    }
27
28
    private function humanizeTime(?string $time): ?string
29
    {
30
        if ($time === null) {
31
            return null;
32
        }
33
34
        $parts = \explode(':', $time);
35
36
        return "{$parts[0]}:{$parts[1]}";
37
    }
38
}
39