FOSSology  4.7.1
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  'cyclonedxSelection' => "ri_cyclonedx_selection",
51  'excludedObligations' => "ri_excluded_obligations",
52  'department' => "ri_department",
53  'depNotes' => "ri_depnotes",
54  'exportNotes' => "ri_exportnotes",
55  'copyrightNotes' => "ri_copyrightnotes",
56  'unifiedColumns' => "ri_unifiedcolumns",
57  'globalDecision' => "ri_globaldecision",
58  ];
59 
64  public function __construct($data = null)
65  {
66  $this->data = $data;
67  }
68 
70 
75  public function getJSON()
76  {
77  return json_encode($this->getArray());
78  }
79 
84  public function getArray()
85  {
86  return array(
87  'reviewed' => $this->data["ri_reviewed"],
88  'footer' => $this->data["ri_footer"],
89  'reportRel' => $this->data["ri_report_rel"],
90  'community' => $this->data["ri_community"],
91  'component' => $this->data["ri_component"],
92  'version' => $this->data["ri_version"],
93  'releaseDate' => $this->data["ri_release_date"],
94  'sw360Link' => $this->data["ri_sw360_link"],
95  'componentType' => ComponentType::TYPE_MAP[$this->data["ri_component_type"]],
96  'componentId' => $this->data["ri_component_id"],
97  'generalAssesment' => $this->data["ri_general_assesment"],
98  'gaAdditional' => $this->data["ri_ga_additional"],
99  'gaRisk' => $this->data["ri_ga_risk"],
100  'gaCheckbox' => $this->data["ri_ga_checkbox_selection"],
101  'spdxSelection' => $this->data["ri_spdx_selection"],
102  'cyclonedxSelection' => json_decode($this->data["ri_cyclonedx_selection"] ?? 'null', true),
103  'excludedObligations' => json_decode($this->data["ri_excluded_obligations"], TRUE),
104  'department' => $this->data["ri_department"],
105  'depNotes' => $this->data["ri_depnotes"],
106  'exportNotes' => $this->data["ri_exportnotes"],
107  'copyrightNotes' => $this->data["ri_copyrightnotes"],
108  'unifiedColumns' => json_decode($this->data["ri_unifiedcolumns"], TRUE),
109  'globalDecision' => boolval($this->data["ri_globaldecision"]),
110  );
111  }
112 
118  public function getKeyColumnName($key)
119  {
120  return self::KEY_MAP[$key];
121  }
122 
128  public function doesKeyExist($key)
129  {
130  return array_key_exists($key, self::KEY_MAP);
131  }
132 }
Conf model to contain general error and return values.
Definition: Conf.php:23
__construct($data=null)
Definition: Conf.php:64