PlaceCollection::addPlace()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace Arthem\GoogleApi\Domain\Place\VO;
4
5
use Arthem\GoogleApi\Domain\Place\Place;
6
7
class PlaceCollection implements \IteratorAggregate
8
{
9
    /**
10
     * @var Place[]
11
     */
12
    private $places = [];
13
14
    /**
15
     * @param Place[] $places
16
     */
17
    public function __construct(array $places = [])
18
    {
19
        $this->places = $places;
20
    }
21
22
    /**
23
     * @param Place $place
24
     *
25
     * @return $this
26
     */
27
    public function addPlace(Place $place)
28
    {
29
        $this->places[] = $place;
30
31
        return $this;
32
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37
    public function getIterator()
38
    {
39
        return new \ArrayIterator($this->places);
40
    }
41
}
42