파일 위치를 twe에서 hwe로 옮김.

This commit is contained in:
2018-04-01 01:23:44 +09:00
parent 1ddd26c8a1
commit 25ec9a2579
201 changed files with 0 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
<?php
namespace sammo\Event;
class EventHandler{
private $condition = null;
private $actions = [];
public function __construct($rawCondition, $rawActions){
$this->condition = Condition::build($rawCondition);
foreach($rawActions as $rawAction){
$this->actions[] = Action::build($rawAction);
}
}
public function tryRunEvent(array $env=null){
$result = $this->condition->eval($env);
if(!$result['value']){
return $result;
}
$resultAction = [];
foreach($this->actions as $action){
$resultAction[] = $action->run();
}
$result['action'] = $resultAction;
return $result;
}
}