ScalarValue::scalar()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 2
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