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

WeightedEdgeSpecifics::getEdgeWeight()   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 1
Bugs 0 Features 1
Metric Value
eloc 1
c 1
b 0
f 1
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\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