FOSSology  4.4.0
Open Source License Compliance by Open Source Software
ClearingResult.php
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2014-2018 Siemens AG
4 
5  SPDX-License-Identifier: GPL-2.0-only
6 */
7 
8 namespace Fossology\Lib\Data\Clearing;
9 
12 
14 {
15 
16  const AGENT_DECISION_TYPE = 'agent';
17 
19  private $clearingEvent;
21  private $agentClearingEvents;
22 
28  public function __construct($licenseDecisionEvent,
29  $agentDecisionEvents = array())
30  {
31  if (($licenseDecisionEvent === null) && (count($agentDecisionEvents) == 0)) {
32  throw new Exception(
33  "cannot create ClearingEvent without any event contained");
34  }
35 
36  $this->clearingEvent = $licenseDecisionEvent;
37  $this->agentClearingEvents = $agentDecisionEvents;
38  }
39 
43  public function getLicenseRef()
44  {
45  return $this->getClearing()->getLicenseRef();
46  }
47 
52  function getLicenseId()
53  {
54  return $this->getClearing()->getLicenseId();
55  }
56 
60  function getLicenseFullName()
61  {
62  return $this->getClearing()->getLicenseFullName();
63  }
64 
69  {
70  return $this->getClearing()->getLicenseShortName();
71  }
72 
76  public function getComment()
77  {
78  return isset($this->clearingEvent) ? $this->clearingEvent->getComment() : '';
79  }
80 
84  public function getEventType()
85  {
86  return $this->getClearing()->getEventType();
87  }
88 
92  public function getReportinfo()
93  {
94  return isset($this->clearingEvent) ? $this->clearingEvent->getReportinfo() : '';
95  }
96 
100  public function getAcknowledgement()
101  {
102  return isset($this->clearingEvent) ? $this->clearingEvent->getAcknowledgement() : '';
103  }
104 
108  public function isRemoved()
109  {
110  return $this->getClearing()->isRemoved();
111  }
112 
117  private function getClearing()
118  {
119  if (isset($this->clearingEvent)) {
120  return $this->clearingEvent;
121  }
122 
123  return $this->agentClearingEvents[0];
124  }
125 
129  public function hasAgentDecisionEvent()
130  {
131  return !empty($this->agentClearingEvents);
132  }
133 
137  public function hasClearingEvent()
138  {
139  return isset($this->clearingEvent);
140  }
141 
145  public function getAgentDecisionEvents()
146  {
147  return $this->agentClearingEvents;
148  }
149 
153  public function getClearingEvent()
154  {
155  return $this->clearingEvent;
156  }
157 
158  /*
159  * @return int clearing timestamp
160  */
161  public function getTimeStamp()
162  {
163  return $this->getClearing()->getTimeStamp();
164  }
165 }
__construct($licenseDecisionEvent, $agentDecisionEvents=array())
Fossology exception.
Definition: Exception.php:15