FOSSology  4.4.0
Open Source License Compliance by Open Source Software
LicenseStandardComment.php
Go to the documentation of this file.
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2024 Divij Sharma <divijs75@gmail.com>
4  SPDX-License-Identifier: GPL-2.0-only
5 */
10 namespace Fossology\UI\Api\Models;
11 
12 
14 {
19  private $id;
24  private $name;
29  private $comment;
34  private $isEnabled;
35 
42  public function __construct($id, $name, $comment, $isEnabled)
43  {
44  $this->id = $id;
45  $this->name = $name;
46  $this->comment = $comment;
47  $this->isEnabled = $isEnabled;
48  }
49 
53  public function getId()
54  {
55  return $this->id;
56  }
57 
61  public function getName()
62  {
63  return $this->name;
64  }
65 
69  public function getComment()
70  {
71  return $this->comment;
72  }
73 
77  public function getIsEnabled()
78  {
79  return $this->isEnabled;
80  }
81 
82 
83 
89  public function getJSON($version=ApiVersion::V1)
90  {
91  return json_encode($this->getArray($version));
92  }
93 
99  public function getArray($version=ApiVersion::V1)
100  {
101  if ($version == ApiVersion::V2) {
102  return [
103  'id' => $this->getId(),
104  'name' => $this->getName(),
105  'comment' => $this->getComment(),
106  'isEnabled' => $this->getIsEnabled()
107  ];
108  }
109  return [
110  'id' => $this->getId(),
111  'name' => $this->getName(),
112  'comment' => $this->getComment(),
113  'is_enabled' => $this->getIsEnabled()
114  ];
115  }
116 
120  public function setId($id)
121  {
122  $this->id = $id;
123  }
124 
128  public function setName($name)
129  {
130  $this->name = $name;
131  }
132 
136  public function setComment($comment)
137  {
138  $this->comment = $comment;
139  }
140 
144  public function setIsEnabled($isEnabled)
145  {
146  $this->isEnabled = $isEnabled;
147  }
148 }