FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
Folder.php
Go to the documentation of this file.
1 <?php
2 /***************************************************************
3 Copyright (C) 2018 Siemens AG
4 
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 version 2 as published by the Free Software Foundation.
8 
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13 
14 You should have received a copy of the GNU General Public License along
15 with this program; if not, write to the Free Software Foundation, Inc.,
16 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  ***************************************************************/
23 namespace Fossology\UI\Api\Models;
24 
25 class Folder
26 {
27 
31  private $id;
32 
36  private $name;
37 
41  private $description;
42 
46  private $parent;
47 
55  public function __construct($id, $name, $description, $parent)
56  {
57  $this->id = intval($id);
58  $this->name = $name;
59  $this->description = $description;
60  if ($parent !== null) {
61  $this->parent = intval($parent);
62  } else {
63  $this->parent = $parent;
64  }
65  }
66 
68 
72  public function getId()
73  {
74  return $this->id;
75  }
76 
80  public function getName()
81  {
82  return $this->name;
83  }
84 
88  public function getDescription()
89  {
90  return $this->description;
91  }
92 
96  public function getParent()
97  {
98  return $this->parent;
99  }
100 
104  public function getJSON()
105  {
106  return json_encode($this->getArray());
107  }
108 
110 
114  public function setId($id)
115  {
116  $this->id = intval($id);
117  }
118 
122  public function setName($name)
123  {
124  $this->name = $name;
125  }
126 
130  public function setDescription($description)
131  {
132  $this->description = $description;
133  }
134 
138  public function setParent($parent)
139  {
140  if ($parent !== null) {
141  $this->parent = intval($parent);
142  } else {
143  $this->parent = $parent;
144  }
145  }
146 
152  public function getArray()
153  {
154  return [
155  'id' => intval($this->id),
156  'name' => $this->name,
157  'description' => $this->description,
158  'parent' => $this->parent
159  ];
160  }
161 }
__construct($id, $name, $description, $parent)
Definition: Folder.php:55
setDescription($description)
Definition: Folder.php:130