FOSSology  4.4.0
Open Source License Compliance by Open Source Software
Conf.php
Go to the documentation of this file.
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2023 Soham Banerjee <sohambanerjee4abc@hotmail.com>
4 
5  SPDX-License-Identifier: GPL-2.0-only
6 */
7 
13 namespace Fossology\UI\Api\Models;
14 
16 
17 
22 class Conf
23 {
28  private $data;
29 
34  const KEY_MAP = [
35  'reviewed' => "ri_reviewed",
36  'footer' => "ri_footer",
37  'reportRel' => "ri_report_rel",
38  'community' => "ri_community",
39  'component' => "ri_component",
40  'version' => "ri_version",
41  'releaseDate' => "ri_release_date",
42  'sw360Link' => "ri_sw360_link",
43  'componentType' => "ri_component_type",
44  'componentId' => "ri_component_id",
45  'generalAssesment' => "ri_general_assesment",
46  'gaAdditional' => "ri_ga_additional",
47  'gaRisk' => "ri_ga_risk",
48  'gaCheckbox' => "ri_ga_checkbox_selection",
49  'spdxSelection' => "ri_spdx_selection",
50  'excludedObligations' => "ri_excluded_obligations",
51  'department' => "ri_department",
52  'depNotes' => "ri_depnotes",
53  'exportNotes' => "ri_exportnotes",
54  'copyrightNotes' => "ri_copyrightnotes",
55  'unifiedColumns' => "ri_unifiedcolumns",
56  'globalDecision' => "ri_globaldecision",
57  ];
58 
63  public function __construct($data = null)
64  {
65  $this->data = $data;
66  }
67 
69 
74  public function getJSON()
75  {
76  return json_encode($this->getArray());
77  }
78 
83  public function getArray()
84  {
85  return array(
86  'reviewed' => $this->data["ri_reviewed"],
87  'footer' => $this->data["ri_footer"],
88  'reportRel' => $this->data["ri_report_rel"],
89  'community' => $this->data["ri_community"],
90  'component' => $this->data["ri_component"],
91  'version' => $this->data["ri_version"],
92  'releaseDate' => $this->data["ri_release_date"],
93  'sw360Link' => $this->data["ri_sw360_link"],
94  'componentType' => ComponentType::TYPE_MAP[$this->data["ri_component_type"]],
95  'componentId' => $this->data["ri_component_id"],
96  'generalAssesment' => $this->data["ri_general_assesment"],
97  'gaAdditional' => $this->data["ri_ga_additional"],
98  'gaRisk' => $this->data["ri_ga_risk"],
99  'gaCheckbox' => $this->data["ri_ga_checkbox_selection"],
100  'spdxSelection' => $this->data["ri_spdx_selection"],
101  'excludedObligations' => json_decode($this->data["ri_excluded_obligations"], TRUE),
102  'department' => $this->data["ri_department"],
103  'depNotes' => $this->data["ri_depnotes"],
104  'exportNotes' => $this->data["ri_exportnotes"],
105  'copyrightNotes' => $this->data["ri_copyrightnotes"],
106  'unifiedColumns' => json_decode($this->data["ri_unifiedcolumns"], TRUE),
107  'globalDecision' => boolval($this->data["ri_globaldecision"]),
108  );
109  }
110 
116  public function getKeyColumnName($key)
117  {
118  return self::KEY_MAP[$key];
119  }
120 
126  public function doesKeyExist($key)
127  {
128  return array_key_exists($key, self::KEY_MAP);
129  }
130 }
Conf model to contain general error and return values.
Definition: Conf.php:23
__construct($data=null)
Definition: Conf.php:63