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

WeightedEdgeSpecifics   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setEdgeWeight() 0 3 1
A getEdgeWeight() 0 3 1
1
<?php
2
3
namespace graphp\edge\specifics;
4
5
use graphp\edge\EdgeInterface;
6
use graphp\vertex\VertexInterface;
7
8
/**
9
 * Class WeightedEdgeSpecifics
10
 *
11
 * @package graphp\edge\specifics
12
 */
13
class WeightedEdgeSpecifics extends UniformEdgeSpecifics
14
{
15
    /**
16
     * Get the edge weight
17
     *
18
     * @param EdgeInterface $edge - the edge
19
     *
20
     * @return float
21
     */
22 1
    public function getEdgeWeight(EdgeInterface $edge): float
23
    {
24 1
        return $edge->getWeight();
0 ignored issues
show
Bug introduced by
The method getWeight() does not exist on graphp\edge\EdgeInterface. It seems like you code against a sub-type of graphp\edge\EdgeInterface such as graphp\edge\DefaultWeightedEdge. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

24
        return $edge->/** @scrutinizer ignore-call */ getWeight();
Loading history...
25
    }
26
    
27
    /**
28
     * Set the edge weight
29
     *
30
     * @param EdgeInterface $edge - the edge
31
     * @param float $weight - the weight
32
     */
33 1
    public function setEdgeWeight(EdgeInterface $edge, float $weight): void
34
    {
35 1
        $edge->setWeight($weight);
0 ignored issues
show
Bug introduced by
The method setWeight() does not exist on graphp\edge\EdgeInterface. It seems like you code against a sub-type of graphp\edge\EdgeInterface such as graphp\edge\DefaultWeightedEdge. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

35
        $edge->/** @scrutinizer ignore-call */ 
36
               setWeight($weight);
Loading history...
36 1
    }
37
}
38