CoverageSpecification   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 28
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A createFromCoverage() 0 5 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