WeightedEdgeSpecifics   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

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 null|float
21
     */
22 8
    public function getEdgeWeight(EdgeInterface $edge): ?float
23
    {
24 8
        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 9
    public function setEdgeWeight(EdgeInterface $edge, ?float $weight = null): void
34
    {
35 9
        $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 9
    }
37
}
38