FOSSology  4.4.0
Open Source License Compliance by Open Source Software
Decider.php
Go to the documentation of this file.
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2017 Siemens AG
4 
5  SPDX-License-Identifier: GPL-2.0-only
6 */
7 
12 namespace Fossology\UI\Api\Models;
13 
18 class Decider
19 {
24  private $nomosMonk;
29  private $bulkReused;
35  private $newScanner;
40  private $ojoDecider;
46 
56  public function __construct($nomosMonk = false, $bulkReused = false,
57  $newScanner = false, $ojoDecider = false,
59  {
60  $this->setNomosMonk($nomosMonk);
61  $this->setBulkReused($bulkReused);
62  $this->setNewScanner($newScanner);
63  $this->setOjoDecider($ojoDecider);
65  }
66 
72  public function setUsingArray($deciderArray, $version = ApiVersion::V1)
73  {
74  if (array_key_exists(($version == ApiVersion::V2? "nomosMonk" : "nomos_monk"), $deciderArray)) {
75  $this->setNomosMonk($deciderArray[$version == ApiVersion::V2? "nomosMonk" : "nomos_monk"]);
76  }
77  if (array_key_exists(($version == ApiVersion::V2? "bulkReused" : "bulk_reused"), $deciderArray)) {
78  $this->setBulkReused($deciderArray[$version == ApiVersion::V2? "bulkReused" : "bulk_reused"]);
79  }
80  if (array_key_exists(($version == ApiVersion::V2? "newScanner" : "new_scanner"), $deciderArray)) {
81  $this->setNewScanner($deciderArray[$version == ApiVersion::V2? "newScanner" : "new_scanner"]);
82  }
83  if (array_key_exists(($version == ApiVersion::V2? "ojoDecider" : "ojo_decider"), $deciderArray)) {
84  $this->setOjoDecider($deciderArray[$version == ApiVersion::V2? "ojoDecider" : "ojo_decider"]);
85  }
86  if (array_key_exists(($version == ApiVersion::V2? "concludeLicenseType" : "conclude_license_type"), $deciderArray)) {
87  $this->setConcludeLicenseType($deciderArray[$version == ApiVersion::V2? "concludeLicenseType" : "conclude_license_type"]);
88  }
89  return $this;
90  }
91 
93 
96  public function getNomosMonk()
97  {
98  return $this->nomosMonk;
99  }
100 
104  public function getBulkReused()
105  {
106  return $this->bulkReused;
107  }
108 
112  public function getNewScanner()
113  {
114  return $this->newScanner;
115  }
116 
120  public function getOjoDecider()
121  {
122  return $this->ojoDecider;
123  }
124 
128  public function getConcludeLicenseType()
129  {
131  }
132 
134 
137  public function setNomosMonk($nomosMonk)
138  {
139  $this->nomosMonk = filter_var($nomosMonk, FILTER_VALIDATE_BOOLEAN);
140  }
141 
145  public function setBulkReused($bulkReused)
146  {
147  $this->bulkReused = filter_var($bulkReused, FILTER_VALIDATE_BOOLEAN);
148  }
149 
153  public function setNewScanner($newScanner)
154  {
155  $this->newScanner = filter_var($newScanner, FILTER_VALIDATE_BOOLEAN);
156  }
157 
161  public function setOjoDecider($ojoDecider)
162  {
163  $this->ojoDecider = filter_var($ojoDecider, FILTER_VALIDATE_BOOLEAN);
164  }
165 
170  {
171  if ($concludeLicenseType !== null) {
172  $this->concludeLicenseType = trim($concludeLicenseType);
173  } else {
174  $this->concludeLicenseType = "";
175  }
176  }
177 
182  public function getArray($version = ApiVersion::V1)
183  {
184  if ($version == ApiVersion::V2) {
185  return [
186  "nomosMonk" => $this->nomosMonk,
187  "bulkReused" => $this->bulkReused,
188  "newScanner" => $this->newScanner,
189  "ojoDecider" => $this->ojoDecider,
190  "concludeLicenseType" => $this->concludeLicenseType
191  ];
192  } else {
193  return [
194  "nomos_monk" => $this->nomosMonk,
195  "bulk_reused" => $this->bulkReused,
196  "new_scanner" => $this->newScanner,
197  "ojo_decider" => $this->ojoDecider,
198  "conclude_license_type" => $this->concludeLicenseType
199  ];
200  }
201  }
202 }
__construct($nomosMonk=false, $bulkReused=false, $newScanner=false, $ojoDecider=false, $concludeLicenseType="")
Definition: Decider.php:56
getArray($version=ApiVersion::V1)
Definition: Decider.php:182
setUsingArray($deciderArray, $version=ApiVersion::V1)
Definition: Decider.php:72
setConcludeLicenseType($concludeLicenseType)
Definition: Decider.php:169
char * trim(char *ptext)
Trimming whitespace.
Definition: fossconfig.c:690