FOSSology  4.4.0
Open Source License Compliance by Open Source Software
LicenseDecision.php
Go to the documentation of this file.
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2023 Samuel Dushimimana <dushsam100@gmail.com>
4 
5  SPDX-License-Identifier: GPL-2.0-only
6 */
7 
13 namespace Fossology\UI\Api\Models;
14 
15 use PhpOffice\PhpSpreadsheet\Calculation\Logical\Boolean;
16 
22 class LicenseDecision extends License
23 {
28  const ALLOWED_KEYS = ['shortName', 'fullName', 'text', 'url', 'risk',
29  'isCandidate', 'mergeRequest', 'source', 'acknowledgement', 'comment'];
30 
35  private $sources;
45  private $comment;
46 
51  private $isMainLicense;
52 
57  private $isRemoved;
58 
64  public function __construct($id,
65  $shortName = "",
66  $fullName = "",
67  $text = "",
68  $url = "",
69  $sources = [], $acknowledgement = "", $comment = "",
70  $isMainLicense = false,
71  $obligations = null,
72  $risk = null,
73  $isRemoved = false,
74  $isCandidate = false)
75  {
76  parent::__construct(
77  $id,
78  $shortName,
79  $fullName,
80  $text,
81  $url,
83  $risk,
85  );
86  $this->setSources($sources);
88  $this->setComment($comment);
90  $this->setIsRemoved($isRemoved);
91  }
92 
93 
98  public function getJSON()
99  {
100  return json_encode($this->getArray());
101  }
102 
107  public function getArray()
108  {
109  $data = parent::getArray();
110  $data['sources'] = $this->getSources();
111  $data['acknowledgement'] = $this->getAcknowledgement();
112  $data['comment'] = $this->getComment();
113  $data['isMainLicense'] = $this->getIsMainLicense();
114  $data['isRemoved'] = $this->getIsRemoved();
115  return $data;
116  }
117 
121  public function getSources(): array
122  {
123  return $this->sources;
124  }
125 
129  public function setSources(array $sources): void
130  {
131  $this->sources = $sources;
132  }
133 
137  public function getAcknowledgement(): string
138  {
139  return $this->acknowledgement;
140  }
141 
145  public function setAcknowledgement(string $acknowledgement): void
146  {
147  $this->acknowledgement = $acknowledgement;
148  }
149 
153  public function getComment(): string
154  {
155  return $this->comment;
156  }
157 
161  public function setComment(string $comment): void
162  {
163  $this->comment = $comment;
164  }
165 
169  public function setIsRemoved(bool $isRemoved): void
170  {
171  $this->isRemoved = $isRemoved;
172  }
173 
177  public function getIsRemoved(): bool
178  {
179  return $this->isRemoved;
180  }
181 
185  public function getIsMainLicense(): bool
186  {
187  return $this->isMainLicense;
188  }
189 
193  public function setIsMainLicense(bool $isMainLicense): void
194  {
195  $this->isMainLicense = $isMainLicense;
196  }
197 }
__construct($id, $shortName="", $fullName="", $text="", $url="", $sources=[], $acknowledgement="", $comment="", $isMainLicense=false, $obligations=null, $risk=null, $isRemoved=false, $isCandidate=false)
setAcknowledgement(string $acknowledgement)