WeightedPseudograph   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 63.64%

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 36
ccs 7
cts 11
cp 0.6364
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 1
A createBuilder() 0 6 2
1
<?php
2
3
namespace Graphp\Graph\Types;
4
5
use Graphp\Graph\Builder\GraphBuilder;
6
use Graphp\Util\SupplierUtil;
7
use Graphp\Util\SupplierInterface;
8
9
/**
10
 * Class WeightedPseudograph
11
 *
12
 * @package Graphp\Graph\Types
13
 */
14
class WeightedPseudograph extends Pseudograph
15
{
16
    /**
17
     * Create a new simple weighted pseudograph
18
     *
19
     * @param string $edgeClass - the edge class
20
     * @param SupplierInterface $vertexSupplier - the vertex supplier
21
     * @param SupplierInterface $edgeSupplier - the edge supplier
22
     */
23 1
    public function __construct(
24
        ?string $edgeClass = null,
25
        ?SupplierInterface $vertexSupplier = null,
26
        ?SupplierInterface $edgeSupplier = null
27
    ) {
28 1
        parent::__construct(
29 1
            $edgeClass,
30 1
            $vertexSupplier,
31 1
            $edgeSupplier,
32 1
            true
33
        );
34 1
    }
35
36
    /**
37
     * Create a simple directed weighted graph builder
38
     *
39
     * @param string $edgeClass - the edge class
40
     * @param SupplierInterface $edgeSupplier - the edge supplier
41
     *
42
     * @return GraphBuilder
43
     */
44
    public function createBuilder(?string $edgeClass = null, ?SupplierInterface $edgeSupplier = null): GraphBuilder
45
    {
46
        if (!is_null($edgeClass)) {
47
            return new GraphBuilder(new WeightedPseudograph($edgeClass));
48
        }
49
        return new GraphBuilder(new WeightedPseudograph(null, $edgeSupplier));
50
    }
51
}
52