12 namespace Fossology\UI\Api\Models;
101 $this->
id = intval(
$id);
109 $this->licenses = [];
110 $this->candidateLicenses = [];
119 return json_encode($this->
getArray());
138 $obligation[
'active'] = $this->
isActive();
142 $obligation[
'hash'] = $this->
getHash();
153 if ($this->topic ===
null) {
165 if ($this->type ===
null) {
177 if ($this->text ===
null) {
189 if ($this->classification ===
null) {
201 if ($this->comment ===
null) {
212 return $this->modification ==
true;
220 return $this->textUpdatable ==
true;
228 return $this->active ==
true;
317 $this->modification = filter_var(
$modification, FILTER_VALIDATE_BOOLEAN);
328 $this->textUpdatable = filter_var(
$textUpdatable, FILTER_VALIDATE_BOOLEAN);
339 $this->active = filter_var(
$active, FILTER_VALIDATE_BOOLEAN);
356 if (empty($shortname)) {
359 $this->licenses[] = $shortname;
368 if (empty($shortname)) {
371 $this->candidateLicenses[] = $shortname;
380 $this->extended = filter_var(
$extended, FILTER_VALIDATE_BOOLEAN);
394 $obligation =
new Obligation($db[
'ob_pk'], $db[
'ob_topic'], $db[
'ob_type'],
395 $db[
'ob_text'], $db[
'ob_classification'], $db[
'ob_comment'],
$extended);
397 $obligation->setModification($db[
'ob_modifications']);
398 $obligation->setActive($db[
'ob_active']);
399 $obligation->setTextUpdatable($db[
'ob_text_updatable']);
400 $obligation->setHash($db[
'ob_md5']);
402 $obligation->addLicense($license);
405 $obligation->addCandidateLicense($candidateLicense);
setClassification($classification)
setModification($modification)
addCandidateLicense($shortname)
static fromArray($db, $extended, $licenses, $candidateLicenses)
setTextUpdatable($textUpdatable)
__construct($id, $topic="", $type="", $text="", $classification="", $comment="", $extended=false)
if(! defined('ENT_SUBSTITUTE')) convertToUTF8($content, $toHTML=true)