Completed
Branch master (d31b6a)
by Bingo
05:22 queued 01:30
created

DefaultWeightedEdge   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
eloc 4
c 1
b 0
f 1
dl 0
loc 27
ccs 4
cts 4
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getWeight() 0 3 1
A setWeight() 0 3 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