ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilCounterDetector.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2016 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
5 require_once './Services/WorkflowEngine/classes/detectors/class.ilSimpleDetector.php';
6 
20 {
27 
35 
41  public function __construct(ilNode $context)
42  {
43  parent::__construct($context);
44  }
45 
51  public function setExpectedTriggerEvents($count)
52  {
53  $this->expected_trigger_events = (int) $count;
54  }
55 
61  public function getExpectedTriggerEvents()
62  {
64  }
65 
72  public function getActualTriggerEvents()
73  {
75  }
76 
87  public function setActualTriggerEvents($count)
88  {
89  if ($this->expected_trigger_events < (int) $count) {
90  $this->actual_trigger_events = $count;
91  } else {
92  // TODO: throw actual must be smaller than expected.
93  }
94  }
95 
106  public function trigger($params)
107  {
108  if ($this->actual_trigger_events < $this->expected_trigger_events) {
109  $this->actual_trigger_events++;
110  if ($this->actual_trigger_events == $this->expected_trigger_events) {
111  $this->setDetectorState(true);
112  }
113  return true;
114  }
115  return false;
116  }
117 }
setExpectedTriggerEvents($count)
Set the expected trigger event count before the detector is satisfied.
trigger($params)
Trigger this detector.
PhpIncludeInspection
getActualTriggerEvents()
Returns the actual trigger events of the detector.
PhpIncludeInspection
Definition: ilNode.php:25
__construct(ilNode $context)
Default constructor, passing the context to the parent constructor.
setDetectorState($new_state)
Sets a new detector state.
getExpectedTriggerEvents()
Returns the currently set number of expected trigger events.
PhpIncludeInspection
setActualTriggerEvents($count)
Sets the actual count of trigger events already taken place.