FOSSology  4.4.0
Open Source License Compliance by Open Source Software
Folder.php
Go to the documentation of this file.
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2018 Siemens AG
4 
5  SPDX-License-Identifier: GPL-2.0-only
6 */
12 namespace Fossology\UI\Api\Models;
13 
14 class Folder
15 {
16 
20  private $id;
21 
25  private $name;
26 
30  private $description;
31 
35  private $parent;
36 
44  public function __construct($id, $name, $description, $parent)
45  {
46  $this->id = intval($id);
47  $this->name = $name;
48  $this->description = $description;
49  if ($parent !== null) {
50  $this->parent = intval($parent);
51  } else {
52  $this->parent = $parent;
53  }
54  }
55 
57 
61  public function getId()
62  {
63  return $this->id;
64  }
65 
69  public function getName()
70  {
71  return $this->name;
72  }
73 
77  public function getDescription()
78  {
79  return $this->description;
80  }
81 
85  public function getParent()
86  {
87  return $this->parent;
88  }
89 
93  public function getJSON()
94  {
95  return json_encode($this->getArray());
96  }
97 
99 
103  public function setId($id)
104  {
105  $this->id = intval($id);
106  }
107 
111  public function setName($name)
112  {
113  $this->name = $name;
114  }
115 
119  public function setDescription($description)
120  {
121  $this->description = $description;
122  }
123 
127  public function setParent($parent)
128  {
129  if ($parent !== null) {
130  $this->parent = intval($parent);
131  } else {
132  $this->parent = $parent;
133  }
134  }
135 
141  public function getArray()
142  {
143  return [
144  'id' => intval($this->id),
145  'name' => $this->name,
146  'description' => $this->description,
147  'parent' => $this->parent
148  ];
149  }
150 }
__construct($id, $name, $description, $parent)
Definition: Folder.php:44
setDescription($description)
Definition: Folder.php:119