ScalarValue   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 71.43%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 33
ccs 5
cts 7
cp 0.7143
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getValue() 0 4 1
A scalar() 0 4 1
1
<?php
2
namespace MachineLearning\Domain\Model\Value;
3
use MachineLearning\Domain\Model\ValueInterface;
4
5
class ScalarValue implements ValueInterface
6
{
7
    /**
8
     * @var float
9
     */
10
    protected $value;
11
12
    /**
13
     * @param float $value
14
     */
15 4
    public function __construct($value)
16
    {
17 4
        $this->value = $value;
18 4
    }
19
20
    /**
21
     * @return float
22
     */
23 4
    public function getValue()
24
    {
25 4
        return $this->value;
26
    }
27
28
    /**
29
     * @inheritdoc
30
     */
31
    public function scalar(ValueInterface $value)
32
    {
33
        return $value->getValue()*$this->getValue();
34
    }
35
36
37
}
38