FOSSology  4.4.0
Open Source License Compliance by Open Source Software
SuccessfulAgent.php
Go to the documentation of this file.
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2023 Akash Kumar Sah <akashsah2003@gmail.com>
4  SPDX-License-Identifier: GPL-2.0-only
5 */
10 namespace Fossology\UI\Api\Models;
11 
12 
14 {
19  private $agentId;
24  private $agentRev;
29  private $agentName;
30 
37  {
38  $this->agentId = $agentId;
39  $this->agentRev = $agentRev;
40  $this->agentName = $agentName;
41  }
42 
46  public function getAgentId()
47  {
48  return $this->agentId;
49  }
50 
54  public function getAgentRev()
55  {
56  return $this->agentRev;
57  }
58 
62  public function getAgentName()
63  {
64  return $this->agentName;
65  }
66 
67 
73  public function getJSON($version=ApiVersion::V1)
74  {
75  return json_encode($this->getArray($version));
76  }
77 
83  public function getArray($version=ApiVersion::V1)
84  {
85  if ($version == ApiVersion::V2) {
86  return [
87  'agentId' => $this->getAgentId(),
88  'agentRev' => $this->getAgentRev(),
89  'agentName' => $this->getAgentName()
90  ];
91  }
92  return [
93  'agent_id' => $this->getAgentId(),
94  'agent_rev' => $this->getAgentRev(),
95  'agent_name' => $this->getAgentName()
96  ];
97  }
98 
102  public function setAgentId($agentId)
103  {
104  $this->agentId = $agentId;
105  }
106 
110  public function setAgentRev($agentRev)
111  {
112  $this->agentRev = $agentRev;
113  }
114 
118  public function setAgentName($agentName)
119  {
120  $this->agentName = $agentName;
121  }
122 }
__construct($agentId, $agentRev, $agentName)