CollectionsResponse   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 4
eloc 14
dl 0
loc 53
rs 10
c 2
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A setCollections() 0 3 1
A addCollection() 0 3 1
A getCollections() 0 2 1
1
<?php
2
3
/*
4
 * This file is part of the pexels-library package.
5
 *
6
 * (c) 2021 WEBEWEB
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace WBW\Library\Pexels\Response;
13
14
use WBW\Library\Pexels\Model\Collection;
15
use WBW\Library\Pexels\Traits\Integers\IntegerTotalResultsTrait;
16
use WBW\Library\Pexels\Traits\Strings\StringNextPageTrait;
17
use WBW\Library\Pexels\Traits\Strings\StringPrevPageTrait;
18
use WBW\Library\Traits\Integers\IntegerPageTrait;
19
use WBW\Library\Traits\Integers\IntegerPerPageTrait;
20
21
/**
22
 * Collections response.
23
 *
24
 * @author webeweb <https://github.com/webeweb>
25
 * @package WBW\Library\Pexels\Response
26
 */
27
class CollectionsResponse extends AbstractResponse {
28
29
    use IntegerPageTrait;
30
    use IntegerPerPageTrait;
31
    use IntegerTotalResultsTrait;
32
    use StringNextPageTrait;
33
    use StringPrevPageTrait;
34
35
    /**
36
     * Collections.
37
     *
38
     * @var Collection[]
39
     */
40
    private $collections;
41
42
    /**
43
     * Constructor.
44
     */
45
    public function __construct() {
46
        parent::__construct();
47
48
        $this->setCollections([]);
49
    }
50
51
    /**
52
     * Add a collection.
53
     *
54
     * @param Collection $collection The collection.
55
     * @return CollectionsResponse Returns this collections response.
56
     */
57
    public function addCollection(Collection $collection): CollectionsResponse {
58
        $this->collections[] = $collection;
59
        return $this;
60
    }
61
62
    /**
63
     * Get the collections.
64
     *
65
     * @return Collection[] Returns the collections.
66
     */
67
    public function getCollections(): array {
68
        return $this->collections;
69
    }
70
71
    /**
72
     * Set the collections.
73
     *
74
     * @param Collection[] $collections The collections.
75
     * @return CollectionsResponse Retrns this collections response.
76
     */
77
    protected function setCollections(array $collections): CollectionsResponse {
78
        $this->collections = $collections;
79
        return $this;
80
    }
81
}
82