Completed
Push — master ( fc7d53...d31b6a )
by Bingo
03:59
created

DefaultWeightedEdge::setWeight()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace graphp\edge;
4
5
use graphp\graph\GraphInterface;
6
use graphp\vertex\VertexInterface;
7
8
/**
9
 * Class DefaultWeightedEdge
10
 *
11
 * @package graphp\edge
12
 */
13
class DefaultWeightedEdge extends DefaultEdge
14
{
15
    /**
16
     * Weight of the edge
17
     *
18
     * @var float
19
     */
20
    protected $weight = GraphInterface::DEFAULT_EDGE_WEIGHT;
21
22
    /**
23
     * Get weight of the edge
24
     *
25
     * @return mixed
26
     */
27 2
    public function getWeight(): float
28
    {
29 2
        return $this->weight;
30
    }
31
32
    /**
33
     * Set the weight of the edge
34
     *
35
     * @param float $weight - the edge weight
36
     */
37 2
    public function setWeight(float $weight): void
38
    {
39 2
        $this->weight = $weight;
40 2
    }
41
}
42