Total Complexity | 5 |
Total Lines | 35 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
30 | class Condition extends Response implements ResponseContract |
||
31 | { |
||
32 | |||
33 | /** |
||
34 | * Handle Conditions, if the source is a Condition |
||
35 | * then we need to handle the conditions. |
||
36 | * |
||
37 | * @return false|mixed |
||
38 | */ |
||
39 | public function parse() |
||
40 | { |
||
41 | if ($this->responseQueueItem()->getCommand() === '*') { |
||
42 | foreach (synapse()->conditions as $class) { |
||
43 | $class = "\\Axiom\\Rivescript\\Cortex\\Conditions\\{$class}"; |
||
44 | $class = new $class(); |
||
45 | |||
46 | $result = $class->parse($this->source()); |
||
47 | |||
48 | if ($result !== false) { |
||
49 | return $result; |
||
50 | } |
||
51 | } |
||
52 | } |
||
53 | return false; |
||
54 | } |
||
55 | |||
56 | /** |
||
57 | * Indicate the type of response this |
||
58 | * class handles. |
||
59 | * |
||
60 | * @return string |
||
61 | */ |
||
62 | public function getType(): string |
||
65 | } |
||
66 | } |
||
67 |