Passed
Push — feature/v4 ( e5e380...dac4aa )
by Samuel
11:37
created

ExtendableCollector   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 5
c 1
b 0
f 0
dl 0
loc 16
ccs 0
cts 5
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A collect() 0 9 4
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Ivory Google Map package.
7
 *
8
 * (c) Eric GELOEN <[email protected]>
9
 *
10
 * For the full copyright and license information, please read the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Ivory\GoogleMap\Helper\Collector\Image;
15
16
use Ivory\GoogleMap\Helper\Collector\AbstractCollector;
17
use Ivory\GoogleMap\Map;
18
use Ivory\GoogleMap\Overlay\ExtendableInterface;
19
use Ivory\GoogleMap\Overlay\Marker;
20
use Ivory\GoogleMap\Overlay\Polyline;
21
22
class ExtendableCollector extends AbstractCollector
23
{
24
    /**
25
     * @param ExtendableInterface[] $extendables
26
     *
27
     * @return ExtendableInterface[]
28
     */
29
    public function collect(Map $map, array $extendables = []): array
30
    {
31
        foreach ($map->getBound()->getExtendables() as $extendable) {
32
            if ($extendable instanceof Marker || $extendable instanceof Polyline) {
33
                $extendables = $this->collectValue($extendable, $extendables);
34
            }
35
        }
36
37
        return $extendables;
38
    }
39
}
40