Completed
Push — master ( 044c87...663c3d )
by Bingo
04:35
created

Pseudograph   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Test Coverage

Coverage 65.22%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 4
eloc 22
dl 0
loc 53
ccs 15
cts 23
cp 0.6522
rs 10
c 1
b 0
f 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 25 2
A createBuilder() 0 6 2
1
<?php
2
3
namespace graphp\graph\types;
4
5
use graphp\graph\AbstractGraph;
6
use graphp\graph\builder\GraphTypeBuilder;
7
use graphp\util\SupplierUtil;
8
9
/**
10
 * Class Pseudograph
11
 *
12
 * @package graphp\graph\types
13
 */
14
class Pseudograph extends AbstractGraph
15
{
16
    /**
17
     * Create a new pseudograph
18
     *
19
     * @param string $edgeClass - the edge class
20
     * @param SupplierInterface $vertexSupplier - the vertex supplier
21
     * @param SupplierInterface $edgeSupplier - the edge supplier
22
     * @param bool $weighted - if the graph is weighted
23
     */
24 1
    public function __construct(
25
        ?string $edgeClass = null,
26
        ?SupplierInterface $vertexSupplier = null,
0 ignored issues
show
Bug introduced by
The type graphp\graph\types\SupplierInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
27
        ?SupplierInterface $edgeSupplier = null,
28
        ?bool $weighted = null
29
    ) {
30 1
        $builder = new GraphTypeBuilder();
31 1
        $graphType = $builder->directed()
32 1
                    ->allowSelfLoops(true)
33 1
                    ->allowMultipleEdges(true)
34 1
                    ->weighted($weighted)
35 1
                    ->build();
36 1
        if (!is_null($edgeClass)) {
37 1
            $util = new SupplierUtil();
38 1
            $edgeSupplier = $util->createSupplier($edgeClass);
39 1
            parent::__construct(
40 1
                $vertexSupplier,
41 1
                $edgeSupplier,
42 1
                $graphType
43
            );
44
        } else {
45
            parent::__construct(
46
                $vertexSupplier,
47
                $edgeSupplier,
48
                $graphType
49
            );
50
        }
51 1
    }
52
53
    /**
54
     * Create a pseudograph builder
55
     *
56
     * @param string $edgeClass - the edge class
57
     * @param SupplierInterface $edgeSupplier - the edge supplier
58
     *
59
     * @return GraphBuilder
60
     */
61
    public function createBuilder(?string $edgeClass = null, ?SupplierInterface $edgeSupplier = null): GraphBuilder
0 ignored issues
show
Bug introduced by
The type graphp\graph\types\GraphBuilder was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
62
    {
63
        if (!is_null($edgeClass)) {
64
            return new GraphBuilder(new Pseudograph($edgeClass));
65
        }
66
        return new GraphBuilder(new Pseudograph(null, $edgeSupplier));
67
    }
68
}
69