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

ExtendableCollector::collect()   A

Complexity

Conditions 4
Paths 3

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 20

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 9
ccs 0
cts 5
cp 0
rs 10
cc 4
nc 3
nop 2
crap 20
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