FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
ClearingResult.php
1 <?php
2 /*
3 Copyright (C) 2014-2018, Siemens AG
4 
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 version 2 as published by the Free Software Foundation.
8 
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13 
14 You should have received a copy of the GNU General Public License along
15 with this program; if not, write to the Free Software Foundation, Inc.,
16 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18 
20 
23 
25 {
26 
27  const AGENT_DECISION_TYPE = 'agent';
28 
30  private $clearingEvent;
32  private $agentClearingEvents;
33 
39  public function __construct($licenseDecisionEvent,
40  $agentDecisionEvents = array())
41  {
42  if (($licenseDecisionEvent === null) && (count($agentDecisionEvents) == 0)) {
43  throw new Exception(
44  "cannot create ClearingEvent without any event contained");
45  }
46 
47  $this->clearingEvent = $licenseDecisionEvent;
48  $this->agentClearingEvents = $agentDecisionEvents;
49  }
50 
54  public function getLicenseRef()
55  {
56  return $this->getClearing()->getLicenseRef();
57  }
58 
63  function getLicenseId()
64  {
65  return $this->getClearing()->getLicenseId();
66  }
67 
71  function getLicenseFullName()
72  {
73  return $this->getClearing()->getLicenseFullName();
74  }
75 
80  {
81  return $this->getClearing()->getLicenseShortName();
82  }
83 
87  public function getComment()
88  {
89  return isset($this->clearingEvent) ? $this->clearingEvent->getComment() : '';
90  }
91 
95  public function getEventType()
96  {
97  return $this->getClearing()->getEventType();
98  }
99 
103  public function getReportinfo()
104  {
105  return isset($this->clearingEvent) ? $this->clearingEvent->getReportinfo() : '';
106  }
107 
111  public function getAcknowledgement()
112  {
113  return isset($this->clearingEvent) ? $this->clearingEvent->getAcknowledgement() : '';
114  }
115 
119  public function isRemoved()
120  {
121  return $this->getClearing()->isRemoved();
122  }
123 
128  private function getClearing()
129  {
130  if (isset($this->clearingEvent)) {
131  return $this->clearingEvent;
132  }
133 
134  return $this->agentClearingEvents[0];
135  }
136 
140  public function hasAgentDecisionEvent()
141  {
142  return !empty($this->agentClearingEvents);
143  }
144 
148  public function hasClearingEvent()
149  {
150  return isset($this->clearingEvent);
151  }
152 
156  public function getAgentDecisionEvents()
157  {
158  return $this->agentClearingEvents;
159  }
160 
164  public function getClearingEvent()
165  {
166  return $this->clearingEvent;
167  }
168 
169  /*
170  * @return int clearing timestamp
171  */
172  public function getTimeStamp()
173  {
174  return $this->getClearing()->getTimeStamp();
175  }
176 }
Fossology exception.
Definition: Exception.php:25
__construct($licenseDecisionEvent, $agentDecisionEvents=array())