FOSSology  4.4.0
Open Source License Compliance by Open Source Software
Analysis.php
Go to the documentation of this file.
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2017 Siemens AG
4  SPDX-FileCopyrightText: © 2021 Orange by Piotr Pszczola <piotr.pszczola@orange.com>
5 
6  SPDX-License-Identifier: GPL-2.0-only
7 */
14 namespace Fossology\UI\Api\Models;
15 
20 class Analysis
21 {
26  private $bucket;
31  private $copyright;
36  private $ecc;
41  private $keyword;
46  private $mimetype;
51  private $monk;
56  private $nomos;
61  private $ojo;
66  private $reso;
71  private $pkgagent;
72 
86  public function __construct($bucket = false, $copyright = false, $ecc = false, $keyword = false,
87  $mimetype = false, $monk = false, $nomos = false, $ojo = false, $reso = false, $pkgagent = false)
88  {
89  $this->bucket = $bucket;
90  $this->copyright = $copyright;
91  $this->ecc = $ecc;
92  $this->keyword = $keyword;
93  $this->mimetype = $mimetype;
94  $this->monk = $monk;
95  $this->nomos = $nomos;
96  $this->ojo = $ojo;
97  $this->reso = $reso;
98  $this->pkgagent = $pkgagent;
99  }
100 
106  public function setUsingArray($analysisArray)
107  {
108  if (array_key_exists("bucket", $analysisArray)) {
109  $this->bucket = filter_var($analysisArray["bucket"],
110  FILTER_VALIDATE_BOOLEAN);
111  }
112  if (array_key_exists("copyright_email_author", $analysisArray)) {
113  $this->copyright = filter_var($analysisArray["copyright_email_author"],
114  FILTER_VALIDATE_BOOLEAN);
115  }
116  if (array_key_exists("ecc", $analysisArray)) {
117  $this->ecc = filter_var($analysisArray["ecc"], FILTER_VALIDATE_BOOLEAN);
118  }
119  if (array_key_exists("keyword", $analysisArray)) {
120  $this->keyword = filter_var($analysisArray["keyword"],
121  FILTER_VALIDATE_BOOLEAN);
122  }
123  if (array_key_exists("mime", $analysisArray)) {
124  $this->mimetype = filter_var($analysisArray["mime"],
125  FILTER_VALIDATE_BOOLEAN);
126  }
127  if (array_key_exists("monk", $analysisArray)) {
128  $this->monk = filter_var($analysisArray["monk"], FILTER_VALIDATE_BOOLEAN);
129  }
130  if (array_key_exists("nomos", $analysisArray)) {
131  $this->nomos = filter_var($analysisArray["nomos"], FILTER_VALIDATE_BOOLEAN);
132  }
133  if (array_key_exists("ojo", $analysisArray)) {
134  $this->ojo = filter_var($analysisArray["ojo"], FILTER_VALIDATE_BOOLEAN);
135  }
136  if (array_key_exists("reso", $analysisArray)) {
137  $this->reso = filter_var($analysisArray["reso"], FILTER_VALIDATE_BOOLEAN);
138  }
139  if (array_key_exists("package", $analysisArray)) {
140  $this->pkgagent = filter_var($analysisArray["package"],
141  FILTER_VALIDATE_BOOLEAN);
142  }
143  return $this;
144  }
145 
151  public function setUsingString($analysisString)
152  {
153  if (stristr($analysisString, "bucket")) {
154  $this->bucket = true;
155  }
156  if (stristr($analysisString, "copyright")) {
157  $this->copyright = true;
158  }
159  if (stristr($analysisString, "ecc")) {
160  $this->ecc = true;
161  }
162  if (stristr($analysisString, "keyword")) {
163  $this->keyword = true;
164  }
165  if (stristr($analysisString, "mimetype")) {
166  $this->mimetype = true;
167  }
168  if (stristr($analysisString, "monk")) {
169  $this->monk = true;
170  }
171  if (stristr($analysisString, "nomos")) {
172  $this->nomos = true;
173  }
174  if (stristr($analysisString, "ojo")) {
175  $this->ojo = true;
176  }
177  if (stristr($analysisString, "reso")) {
178  $this->reso = true;
179  }
180  if (stristr($analysisString, "pkgagent")) {
181  $this->pkgagent = true;
182  }
183  return $this;
184  }
185 
187 
190  public function getBucket()
191  {
192  return $this->bucket;
193  }
194 
198  public function getCopyright()
199  {
200  return $this->copyright;
201  }
202 
206  public function getEcc()
207  {
208  return $this->ecc;
209  }
210 
214  public function getKeyword()
215  {
216  return $this->keyword;
217  }
218 
222  public function getMime()
223  {
224  return $this->mimetype;
225  }
226 
230  public function getMonk()
231  {
232  return $this->monk;
233  }
234 
238  public function getNomos()
239  {
240  return $this->nomos;
241  }
242 
246  public function getOjo()
247  {
248  return $this->ojo;
249  }
250 
254  public function getReso()
255  {
256  return $this->reso;
257  }
258 
262  public function getPackage()
263  {
264  return $this->pkgagent;
265  }
266 
268 
271  public function setBucket($bucket)
272  {
273  $this->bucket = filter_var($bucket, FILTER_VALIDATE_BOOLEAN);
274  }
275 
279  public function setCopyright($copyright)
280  {
281  $this->copyright = filter_var($copyright, FILTER_VALIDATE_BOOLEAN);
282  }
283 
287  public function setEcc($ecc)
288  {
289  $this->ecc = filter_var($ecc, FILTER_VALIDATE_BOOLEAN);
290  }
291 
295  public function setKeyword($keyword)
296  {
297  $this->keyword = filter_var($keyword, FILTER_VALIDATE_BOOLEAN);
298  }
299 
303  public function setMime($mime)
304  {
305  $this->mimetype = filter_var($mime, FILTER_VALIDATE_BOOLEAN);
306  }
307 
311  public function setMonk($monk)
312  {
313  $this->monk = filter_var($monk, FILTER_VALIDATE_BOOLEAN);
314  }
315 
319  public function setNomos($nomos)
320  {
321  $this->nomos = filter_var($nomos, FILTER_VALIDATE_BOOLEAN);
322  }
323 
327  public function setOjo($ojo)
328  {
329  $this->ojo = filter_var($ojo, FILTER_VALIDATE_BOOLEAN);
330  }
331 
335  public function setReso($reso)
336  {
337  $this->reso = filter_var($reso, FILTER_VALIDATE_BOOLEAN);
338  }
339 
343  public function setPackage($package)
344  {
345  $this->pkgagent = filter_var($package, FILTER_VALIDATE_BOOLEAN);
346  }
347 
352  public function getArray()
353  {
354  return [
355  "bucket" => $this->bucket,
356  "copyright_email_author" => $this->copyright,
357  "ecc" => $this->ecc,
358  "keyword" => $this->keyword,
359  "mimetype" => $this->mimetype,
360  "monk" => $this->monk,
361  "nomos" => $this->nomos,
362  "ojo" => $this->ojo,
363  "reso" => $this->reso,
364  "package" => $this->pkgagent
365  ];
366  }
367 }
Model to hold analysis settings.
Definition: Analysis.php:21
__construct($bucket=false, $copyright=false, $ecc=false, $keyword=false, $mimetype=false, $monk=false, $nomos=false, $ojo=false, $reso=false, $pkgagent=false)
Definition: Analysis.php:86
setUsingString($analysisString)
Definition: Analysis.php:151