Passed
Pull Request — main (#10)
by
unknown
02:31
created

GeometryCollection   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Test Coverage

Coverage 55.56%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 4
eloc 8
dl 0
loc 38
ccs 5
cts 9
cp 0.5556
rs 10
c 2
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getGeometryObjects() 0 3 1
A getGeometryObjectCallback() 0 3 1
A addGeometryObject() 0 5 1
A setGeometryObjectCallback() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PrinsFrank\PhpGeoSVG\Geometry;
6
7
use PrinsFrank\PhpGeoSVG\Geometry\GeometryObject\GeometryObject;
8
9
class GeometryCollection
10
{
11
    /** @var GeometryObject[] */
12
    protected array $geometryObjects = [];
13
14
    /** @var ?GeometryObjectCallback */
15
    protected ?GeometryObjectCallback $geometryObjectCallback = null;
16
17 1
    public function addGeometryObject(GeometryObject $geometryObject): self
18
    {
19 1
        $this->geometryObjects[] = $geometryObject;
20
21 1
        return $this;
22
    }
23
24
    /**
25
     * @return GeometryObject[]
26
     */
27 1
    public function getGeometryObjects(): array
28
    {
29 1
        return $this->geometryObjects;
30
    }
31
32
    /**
33
     * @return ?GeometryObjectCallback
34
     */
35
    public function getGeometryObjectCallback(): ?GeometryObjectCallback
36
    {
37
        return $this->geometryObjectCallback;
38
    }
39
40
    /**
41
     * @param GeometryObjectCallback $geometryObjectCallback
42
     * @return void
43
     */
44
    public function setGeometryObjectCallback(GeometryObjectCallback $geometryObjectCallback): void
45
    {
46
        $this->geometryObjectCallback = $geometryObjectCallback;
47
    }
48
49
50
}
51