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.

Dumper::toString()   A
last analyzed

Complexity

Conditions 3
Paths 1

Size

Total Lines 13
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
eloc 11
nc 1
nop 1
dl 0
loc 13
c 0
b 0
f 0
cc 3
rs 9.9
ccs 0
cts 13
cp 0
crap 12
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Deployer\Component\PharUpdate\Version;
6
7
/**
8
 * Dumps the Version instance to a variety of formats.
9
 *
10
 * @author Kevin Herrera <[email protected]>
11
 */
12
class Dumper
13
{
14
    /**
15
     * Returns the components of a Version instance.
16
     *
17
     * @param Version $version A version.
18
     *
19
     * @return array The components.
20
     */
21
    public static function toComponents(Version $version)
22
    {
23
        return [
24
            Parser::MAJOR => $version->getMajor(),
25
            Parser::MINOR => $version->getMinor(),
26
            Parser::PATCH => $version->getPatch(),
27
            Parser::PRE_RELEASE => $version->getPreRelease(),
28
            Parser::BUILD => $version->getBuild(),
29
        ];
30
    }
31
32
    /**
33
     * Returns the string representation of a Version instance.
34
     *
35
     * @param Version $version A version.
36
     *
37
     * @return string The string representation.
38
     */
39
    public static function toString(Version $version)
40
    {
41
        return sprintf(
42
            '%d.%d.%d%s%s',
43
            $version->getMajor(),
44
            $version->getMinor(),
45
            $version->getPatch(),
46
            $version->getPreRelease()
47
                ? '-' . join('.', $version->getPreRelease())
48
                : '',
49
            $version->getBuild()
50
                ? '+' . join('.', $version->getBuild())
51
                : '',
52
        );
53
    }
54
}
55