FOSSology  4.4.0
Open Source License Compliance by Open Source Software
EditedLicense.php
Go to the documentation of this file.
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2023 Akash Kumar Sah <akashsah2003@gmail.com>
4  SPDX-License-Identifier: GPL-2.0-only
5 */
10 namespace Fossology\UI\Api\Models;
11 
13 {
18  private $id;
23  private $shortName;
28  private $count;
33  private $spdxId;
34 
41  public function __construct($id, $shortName, $count, $spdxId)
42  {
43  $this->id = $id;
44  $this->shortName = $shortName;
45  $this->count = $count;
46  $this->spdxId = $spdxId;
47  }
48 
52  public function getId()
53  {
54  return $this->id;
55  }
56 
60  public function getShortName()
61  {
62  return $this->shortName;
63  }
64 
68  public function getCount()
69  {
70  return $this->count;
71  }
72 
76  public function getSpdxId()
77  {
78  return $this->spdxId;
79  }
80 
86  public function getJSON($version=ApiVersion::V1)
87  {
88  return json_encode($this->getArray($version));
89  }
90 
96  public function getArray($version=ApiVersion::V1)
97  {
98  if ($version == ApiVersion::V2) {
99  return [
100  'id' => $this->getId(),
101  'shortName' => $this->getShortName(),
102  'count' => $this->getCount(),
103  'spdxId' => $this->getSpdxId()
104  ];
105  }
106  return [
107  'id' => $this->getId(),
108  'shortName' => $this->getShortName(),
109  'count' => $this->getCount(),
110  'spdx_id' => $this->getSpdxId()
111  ];
112  }
113 
117  public function setId($id)
118  {
119  $this->id = $id;
120  }
121 
125  public function setShortName($shortName)
126  {
127  $this->shortName = $shortName;
128  }
129 
133  public function setCount($count)
134  {
135  $this->count = $count;
136  }
137 
141  public function setSpdxId($spdxId)
142  {
143  $this->spdxId = $spdxId;
144  }
145 }
getJSON($version=ApiVersion::V1)
getArray($version=ApiVersion::V1)
__construct($id, $shortName, $count, $spdxId)