FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
Analysis.php
Go to the documentation of this file.
1 <?php
2 /***************************************************************
3 Copyright (C) 2017 Siemens AG
4 
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 version 2 as published by the Free Software Foundation.
8 
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13 
14 You should have received a copy of the GNU General Public License along
15 with this program; if not, write to the Free Software Foundation, Inc.,
16 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  ***************************************************************/
24 namespace Fossology\UI\Api\Models;
25 
30 class Analysis
31 {
36  private $bucket;
41  private $copyright;
46  private $ecc;
51  private $keyword;
56  private $mimetype;
61  private $monk;
66  private $nomos;
71  private $ojo;
76  private $pkgagent;
77 
90  public function __construct($bucket = false, $copyright = false, $ecc = false, $keyword = false,
91  $mimetype = false, $monk = false, $nomos = false, $ojo = false, $pkgagent = false)
92  {
93  $this->bucket = $bucket;
94  $this->copyright = $copyright;
95  $this->ecc = $ecc;
96  $this->keyword = $keyword;
97  $this->mimetype = $mimetype;
98  $this->monk = $monk;
99  $this->nomos = $nomos;
100  $this->ojo = $ojo;
101  $this->pkgagent = $pkgagent;
102  }
103 
109  public function setUsingArray($analysisArray)
110  {
111  if (array_key_exists("bucket", $analysisArray)) {
112  $this->bucket = filter_var($analysisArray["bucket"],
113  FILTER_VALIDATE_BOOLEAN);
114  }
115  if (array_key_exists("copyright_email_author", $analysisArray)) {
116  $this->copyright = filter_var($analysisArray["copyright_email_author"],
117  FILTER_VALIDATE_BOOLEAN);
118  }
119  if (array_key_exists("ecc", $analysisArray)) {
120  $this->ecc = filter_var($analysisArray["ecc"], FILTER_VALIDATE_BOOLEAN);
121  }
122  if (array_key_exists("keyword", $analysisArray)) {
123  $this->keyword = filter_var($analysisArray["keyword"],
124  FILTER_VALIDATE_BOOLEAN);
125  }
126  if (array_key_exists("mime", $analysisArray)) {
127  $this->mimetype = filter_var($analysisArray["mime"],
128  FILTER_VALIDATE_BOOLEAN);
129  }
130  if (array_key_exists("monk", $analysisArray)) {
131  $this->monk = filter_var($analysisArray["monk"], FILTER_VALIDATE_BOOLEAN);
132  }
133  if (array_key_exists("nomos", $analysisArray)) {
134  $this->nomos = filter_var($analysisArray["nomos"], FILTER_VALIDATE_BOOLEAN);
135  }
136  if (array_key_exists("ojo", $analysisArray)) {
137  $this->ojo = filter_var($analysisArray["ojo"], 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, "pkgagent")) {
178  $this->pkgagent = true;
179  }
180  return $this;
181  }
182 
184 
187  public function getBucket()
188  {
189  return $this->bucket;
190  }
191 
195  public function getCopyright()
196  {
197  return $this->copyright;
198  }
199 
203  public function getEcc()
204  {
205  return $this->ecc;
206  }
207 
211  public function getKeyword()
212  {
213  return $this->keyword;
214  }
215 
219  public function getMime()
220  {
221  return $this->mimetype;
222  }
223 
227  public function getMonk()
228  {
229  return $this->monk;
230  }
231 
235  public function getNomos()
236  {
237  return $this->nomos;
238  }
239 
243  public function getOjo()
244  {
245  return $this->ojo;
246  }
247 
251  public function getPackage()
252  {
253  return $this->pkgagent;
254  }
255 
257 
260  public function setBucket($bucket)
261  {
262  $this->bucket = filter_var($bucket, FILTER_VALIDATE_BOOLEAN);
263  }
264 
268  public function setCopyright($copyright)
269  {
270  $this->copyright = filter_var($copyright, FILTER_VALIDATE_BOOLEAN);
271  }
272 
276  public function setEcc($ecc)
277  {
278  $this->ecc = filter_var($ecc, FILTER_VALIDATE_BOOLEAN);
279  }
280 
284  public function setKeyword($keyword)
285  {
286  $this->keyword = filter_var($keyword, FILTER_VALIDATE_BOOLEAN);
287  }
288 
292  public function setMime($mime)
293  {
294  $this->mimetype = filter_var($mime, FILTER_VALIDATE_BOOLEAN);
295  }
296 
300  public function setMonk($monk)
301  {
302  $this->monk = filter_var($monk, FILTER_VALIDATE_BOOLEAN);
303  }
304 
308  public function setNomos($nomos)
309  {
310  $this->nomos = filter_var($nomos, FILTER_VALIDATE_BOOLEAN);
311  }
312 
316  public function setOjo($ojo)
317  {
318  $this->ojo = filter_var($ojo, FILTER_VALIDATE_BOOLEAN);
319  }
320 
324  public function setPackage($package)
325  {
326  $this->pkgagent = filter_var($package, FILTER_VALIDATE_BOOLEAN);
327  }
328 
333  public function getArray()
334  {
335  return [
336  "bucket" => $this->bucket,
337  "copyright_email_author" => $this->copyright,
338  "ecc" => $this->ecc,
339  "keyword" => $this->keyword,
340  "mimetype" => $this->mimetype,
341  "monk" => $this->monk,
342  "nomos" => $this->nomos,
343  "ojo" => $this->ojo,
344  "package" => $this->pkgagent
345  ];
346  }
347 }
setUsingString($analysisString)
Definition: Analysis.php:151
__construct($bucket=false, $copyright=false, $ecc=false, $keyword=false, $mimetype=false, $monk=false, $nomos=false, $ojo=false, $pkgagent=false)
Definition: Analysis.php:90
Model to hold analysis settings.
Definition: Analysis.php:30