CoverageSpecification::createFromCoverage()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
/**
4
 * This file is part of cloak.
5
 *
6
 * (c) Noritaka Horio <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace cloak\result\specification;
13
14
15
use cloak\value\Coverage;
16
use cloak\result\Specification;
17
18
19
/**
20
 * Class CoverageSpecification
21
 * @package cloak\result\specification
22
 */
23
abstract class CoverageSpecification implements Specification
24
{
25
26
    /**
27
     * @var Coverage
28
     */
29
    protected $coverage;
30
31
32
    /**
33
     * @param float $value
34
     */
35
    public function __construct($value)
36
    {
37
        $this->coverage = new Coverage($value);
38
    }
39
40
    /**
41
     * @param Coverage $coverage
42
     * @return \cloak\result\Specification
43
     */
44
    public static function createFromCoverage(Coverage $coverage)
45
    {
46
        $value = $coverage->value();
47
        return new static($value);
48
    }
49
50
}
51