Passed
Push — master ( 8bd994...8bfb27 )
by Théo
02:28
created

IsPhpVersionFulfilled::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the box project.
5
 *
6
 * (c) Kevin Herrera <[email protected]>
7
 *     Théo Fidry <[email protected]>
8
 *
9
 * This source file is subject to the MIT license that is bundled
10
 * with this source code in the file LICENSE.
11
 */
12
13
namespace KevinGH\RequirementChecker;
14
15
use Composer\Semver\Semver;
16
17
/**
18
 * @private
19
 */
20
final class IsPhpVersionFulfilled implements IsFulfilled
21
{
22
    private $requiredPhpVersion;
23
24
    /**
25
     * @param string $requiredPhpVersion
26
     */
27
    public function __construct($requiredPhpVersion)
28
    {
29
        $this->requiredPhpVersion = $requiredPhpVersion;
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function __invoke()
36
    {
37
        return Semver::satisfies(
38
            sprintf('%d.%d.%d', \PHP_MAJOR_VERSION, \PHP_MINOR_VERSION, \PHP_RELEASE_VERSION),
39
            $this->requiredPhpVersion
40
        );
41
    }
42
}
43