FOSSology  4.4.0
Open Source License Compliance by Open Source Software
ScannedLicense.php
Go to the documentation of this file.
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2023 Samuel Dushimimana <dushsam100@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 $occurence;
33  private $unique;
38  private $spdxName;
39 
48  {
49  $this->id = $id;
50  $this->shortname = $shortname;
51  $this->occurence = $occurence;
52  $this->unique = $unique;
53  $this->spdxName = $spdxName;
54  }
55 
59  public function getId()
60  {
61  return $this->id;
62  }
63 
67  public function getShortname()
68  {
69  return $this->shortname;
70  }
71 
75  public function getOccurence()
76  {
77  return $this->occurence;
78  }
79 
83  public function getUnique()
84  {
85  return $this->unique;
86  }
87 
91  public function getSpdxName()
92  {
93  return $this->spdxName;
94  }
95 
101  public function getJSON($version=ApiVersion::V1)
102  {
103  return json_encode($this->getArray($version));
104  }
105 
111  public function getArray($version=ApiVersion::V1)
112  {
113  if ($version == ApiVersion::V2) {
114  return [
115  'id' => $this->getId(),
116  'shortName' => $this->getShortname(),
117  'occurence' => $this->getOccurence(),
118  'unique' => $this->getUnique(),
119  'spdxName' => $this->getSpdxName()
120  ];
121  }
122  return [
123  'id' => $this->getId(),
124  'shortname' => $this->getShortname(),
125  'occurence' => $this->getOccurence(),
126  'unique' => $this->getUnique(),
127  'spdxName' => $this->getSpdxName()
128  ];
129  }
130 
134  public function setId($id)
135  {
136  $this->id = $id;
137  }
138 
142  public function setShortname($shortname)
143  {
144  $this->shortname = $shortname;
145  }
146 
150  public function setOccurence($occurence)
151  {
152  $this->occurence = $occurence;
153  }
154 
158  public function setUnique($unique)
159  {
160  $this->unique = $unique;
161  }
162 
166  public function setSpdxName($spdxName)
167  {
168  $this->spdxName = $spdxName;
169  }
170 }
__construct($id, $shortname, $occurence, $unique, $spdxName)