FOSSology  4.4.0
Open Source License Compliance by Open Source Software
Scancode.php
Go to the documentation of this file.
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2021 Sarita Singh <saritasingh.0425@gmail.com>
4 
5  SPDX-License-Identifier: GPL-2.0-only
6 */
7 
12 namespace Fossology\UI\Api\Models;
13 
18 class Scancode
19 {
23  private $scanLicense;
27  private $scanCopyright;
31  private $scanEmail;
35  private $scanUrl;
36 
45  public function __construct($scanLicense = false, $scanCopyright = false, $scanEmail = false, $scanUrl = false)
46  {
47  $this->scanLicense = $scanLicense;
48  $this->scanCopyright = $scanCopyright;
49  $this->scanEmail = $scanEmail;
50  $this->scanUrl = $scanUrl;
51  }
52 
58  public function setUsingArray($scancodeArray)
59  {
60  if (array_key_exists("license", $scancodeArray)) {
61  $this->scanLicense = filter_var($scancodeArray["license"],
62  FILTER_VALIDATE_BOOLEAN);
63  }
64  if (array_key_exists("copyright", $scancodeArray)) {
65  $this->scanCopyright = filter_var($scancodeArray["copyright"],
66  FILTER_VALIDATE_BOOLEAN);
67  }
68  if (array_key_exists("email", $scancodeArray)) {
69  $this->scanEmail = filter_var($scancodeArray["email"],
70  FILTER_VALIDATE_BOOLEAN);
71  }
72  if (array_key_exists("url", $scancodeArray)) {
73  $this->scanUrl = filter_var($scancodeArray["url"],
74  FILTER_VALIDATE_BOOLEAN);
75  }
76  return $this;
77  }
78 
80 
83  public function getScanLicense()
84  {
85  return $this->scanLicense;
86  }
87 
91  public function getScanCopyright()
92  {
93  return $this->scanCopyright;
94  }
95 
99  public function getScanEmail()
100  {
101  return $this->scanEmail;
102  }
103 
107  public function getScanUrl()
108  {
109  return $this->scanUrl;
110  }
111 
113 
116  public function setScanLicense($scanLicense)
117  {
118  $this->scanLicense = filter_var($scanLicense, FILTER_VALIDATE_BOOLEAN);
119  }
120 
124  public function setScanCopyright($scanCopyright)
125  {
126  $this->scanCopyright = filter_var($scanCopyright, FILTER_VALIDATE_BOOLEAN);
127  }
128 
132  public function setScanEmail($scanEmail)
133  {
134  $this->scanEmail = filter_var($scanEmail, FILTER_VALIDATE_BOOLEAN);
135  }
136 
140  public function setScanUrl($scanUrl)
141  {
142  $this->scanUrl = filter_var($scanUrl, FILTER_VALIDATE_BOOLEAN);
143  }
144 
149  public function getArray()
150  {
151  return [
152  "license" => $this->scanLicense,
153  "copyright" => $this->scanCopyright,
154  "email" => $this->scanEmail,
155  "url" => $this->scanUrl
156  ];
157  }
158 }
setScanCopyright($scanCopyright)
Definition: Scancode.php:124
__construct($scanLicense=false, $scanCopyright=false, $scanEmail=false, $scanUrl=false)
Definition: Scancode.php:45
setUsingArray($scancodeArray)
Definition: Scancode.php:58