Completed
Pull Request — master (#3)
by Arthur
02:27
created

PhotoCollection::addPhoto()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
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
class PhotoCollection implements \IteratorAggregate, \Countable
6
{
7
    /**
8
     * @var Photo[]
9
     */
10
    private $photos;
11
12
    /**
13
     * @param Photo $photo
14
     *
15
     * @return $this
16
     */
17
    public function addPhoto(Photo $photo)
18
    {
19
        $this->photos[] = $photo;
20
21
        return $this;
22
    }
23
24
    /**
25
     * {@inheritdoc}
26
     */
27
    public function getIterator()
28
    {
29
        return new \ArrayIterator($this->photos);
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function count()
36
    {
37
        return count($this->photos);
38
    }
39
}
40