Folder::setRequests()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 1
1
<?php
2
3
/*
4
 * This file is part of the PostmanGeneratorBundle package.
5
 *
6
 * (c) Vincent Chalamon <[email protected]>
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 PostmanGeneratorBundle\Model;
13
14
class Folder
15
{
16
    /**
17
     * @var string
18
     */
19
    private $id;
20
21
    /**
22
     * @var string
23
     */
24
    private $name;
25
26
    /**
27
     * @var int
28
     */
29
    private $owner = 0;
30
31
    /**
32
     * @var Collection
33
     */
34
    private $collection;
35
36
    /**
37
     * @var array
38
     */
39
    private $order = [];
40
41
    /**
42
     * @var Request[]
43
     */
44
    private $requests = [];
45
46
    /**
47
     * @return string
48
     */
49
    public function getId()
50
    {
51
        return $this->id;
52
    }
53
54
    /**
55
     * @param string $id
56
     */
57
    public function setId($id)
58
    {
59
        $this->id = $id;
60
    }
61
62
    /**
63
     * @return string
64
     */
65
    public function getName()
66
    {
67
        return $this->name;
68
    }
69
70
    /**
71
     * @param string $name
72
     */
73
    public function setName($name)
74
    {
75
        $this->name = $name;
76
    }
77
78
    /**
79
     * @return int
80
     */
81
    public function getOwner()
82
    {
83
        return $this->owner;
84
    }
85
86
    /**
87
     * @param int $owner
88
     */
89
    public function setOwner($owner)
90
    {
91
        $this->owner = $owner;
92
    }
93
94
    /**
95
     * @return Collection
96
     */
97
    public function getCollection()
98
    {
99
        return $this->collection;
100
    }
101
102
    /**
103
     * @param Collection $collection
104
     */
105
    public function setCollection(Collection $collection)
106
    {
107
        $this->collection = $collection;
108
    }
109
110
    /**
111
     * @return array
112
     */
113
    public function getOrder()
114
    {
115
        return $this->order;
116
    }
117
118
    /**
119
     * @param array $order
120
     */
121
    public function setOrder($order)
122
    {
123
        $this->order = $order;
124
    }
125
126
    /**
127
     * @return Request[]
128
     */
129
    public function getRequests()
130
    {
131
        return $this->requests;
132
    }
133
134
    /**
135
     * @param Request[] $requests
136
     */
137
    public function setRequests($requests)
138
    {
139
        $this->requests = [];
140
        foreach ($requests as $request) {
141
            $this->addRequest($request);
142
        }
143
    }
144
145
    /**
146
     * @param Request $request
147
     */
148
    public function addRequest(Request $request)
149
    {
150
        $request->setFolder($this);
151
        $this->order[] = $request->getId();
152
        $this->requests[] = $request;
153
    }
154
}
155