ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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
5require_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}
An exception for terminatinating execution or to throw for unit testing.
@noinspection PhpIncludeInspection
trigger($params)
Trigger this detector.
getExpectedTriggerEvents()
Returns the currently set number of expected trigger events.
setActualTriggerEvents($count)
Sets the actual count of trigger events already taken place.
getActualTriggerEvents()
Returns the actual trigger events of the detector.
setExpectedTriggerEvents($count)
Set the expected trigger event count before the detector is satisfied.
__construct(ilNode $context)
Default constructor, passing the context to the parent constructor.
@noinspection PhpIncludeInspection
setDetectorState($new_state)
Sets a new detector state.
@noinspection PhpIncludeInspection
Definition: ilNode.php:26
$params
Definition: disable.php:11