FOSSology  4.4.0
Open Source License Compliance by Open Source Software
UploadSummary.php
Go to the documentation of this file.
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2020 Siemens AG
4 
5  SPDX-License-Identifier: GPL-2.0-only
6 */
11 namespace Fossology\UI\Api\Models;
12 
14 
20 {
21 
26  private $mainLicense;
31  private $uniqueLicenses;
36  private $uploadId;
41  private $totalLicenses;
46  private $uploadName;
51  private $assignee;
71  private $filesCleared;
76  private $clearingStatus;
81  private $copyrightCount;
91  private $fileCount;
102 
103  public function __construct()
104  {
105  $this->mainLicense = null;
106  $this->uniqueLicenses = 0;
107  $this->uploadId = null;
108  $this->totalLicenses = 0;
109  $this->uploadName = null;
110  $this->uniqueConcludedLicenses = 0;
111  $this->totalConcludedLicenses = 0;
112  $this->filesToBeCleared = 0;
113  $this->filesCleared = 0;
114  $this->clearingStatus = UploadStatus::OPEN;
115  $this->copyrightCount = 0;
116  $this->assignee = null;
117  $this->concludedNoLicenseFoundCount = 0;
118  $this->fileCount = 0;
119  $this->noScannerLicenseFoundCount = 0;
120  $this->scannerUniqueLicenseCount = 0;
121  }
122 
127  public function getJSON()
128  {
129  return json_encode($this->getArray());
130  }
131 
136  public function getArray()
137  {
138  return [
139  "id" => $this->uploadId,
140  "uploadName" => $this->uploadName,
141  "assignee" => $this->assignee,
142  "mainLicense" => $this->mainLicense,
143  "uniqueLicenses" => $this->uniqueLicenses,
144  "totalLicenses" => $this->totalLicenses,
145  "uniqueConcludedLicenses" => $this->uniqueConcludedLicenses,
146  "totalConcludedLicenses" => $this->totalConcludedLicenses,
147  "filesToBeCleared" => $this->filesToBeCleared,
148  "filesCleared" => $this->filesCleared,
149  "clearingStatus" => self::statusToString($this->clearingStatus),
150  "copyrightCount" => $this->copyrightCount,
151  "concludedNoLicenseFoundCount" => $this->concludedNoLicenseFoundCount,
152  "fileCount" => $this->fileCount,
153  "noScannerLicenseFoundCount" => $this->noScannerLicenseFoundCount,
154  "scannerUniqueLicenseCount" => $this->scannerUniqueLicenseCount
155  ];
156  }
157 
161  public function setMainLicense($mainLicense)
162  {
163  $this->mainLicense = $mainLicense;
164  }
165 
170  {
171  $this->uniqueLicenses = intval($uniqueLicenses);
172  }
173 
177  public function setUploadId($uploadId)
178  {
179  $this->uploadId = intval($uploadId);
180  }
181 
186  {
187  $this->totalLicenses = intval($totalLicenses);
188  }
189 
193  public function setUploadName($uploadName)
194  {
195  $this->uploadName = $uploadName;
196  }
197 
201  public function setAssignee($assignee)
202  {
203  $this->assignee = $assignee == 1 ? null : intval($assignee);
204  }
205 
210  {
211  $this->uniqueConcludedLicenses = intval($uniqueConcludedLicenses);
212  }
213 
218  {
219  $this->totalConcludedLicenses = intval($totalConcludedLicenses);
220  }
221 
226  {
227  $this->filesToBeCleared = intval($filesToBeCleared);
228  }
229 
234  {
235  $this->filesCleared = intval($filesCleared);
236  }
237 
242  {
243  $this->clearingStatus = $clearingStatus;
244  }
245 
250  {
251  $this->copyrightCount = intval($copyrightCount);
252  }
253 
258  {
259  $this->concludedNoLicenseFoundCount = intval($concludedNoLicenseFoundCount);
260  }
261 
265  public function setFileCount($fileCount)
266  {
267  $this->fileCount = intval($fileCount);
268  }
269 
274  {
275  $this->noScannerLicenseFoundCount = intval($noScannerLicenseFoundCount);
276  }
277 
282  {
283  $this->scannerUniqueLicenseCount = intval($scannerUniqueLicenseCount);
284  }
285 
291  public static function statusToString($status)
292  {
293  $string = null;
294  switch ($status) {
295  case UploadStatus::OPEN:
296  $string = "Open";
297  break;
298  case UploadStatus::IN_PROGRESS:
299  $string = "InProgress";
300  break;
301  case UploadStatus::CLOSED:
302  $string = "Closed";
303  break;
304  case UploadStatus::REJECTED:
305  $string = "Rejected";
306  break;
307  default:
308  $string = "NA";
309  }
310  return $string;
311  }
312 }
Model class to hold Upload info.
setUniqueConcludedLicenses($uniqueConcludedLicenses)
setNoScannerLicenseFoundCount($noScannerLicenseFoundCount)
setTotalConcludedLicenses($totalConcludedLicenses)
setScannerUniqueLicenseCount($scannerUniqueLicenseCount)
setConcludedNoLicenseFoundCount($concludedNoLicenseFoundCount)