Files
core/hwe/sammo/Event/EventHandler.php
T
Hide_D 269a40ca9d stylesheet 잘못 불러오는 문제 해결.
jquery.redirect 추가.
global 변수 extract 우회가 제대로 동작하지 않던 문제 해결
2018-04-09 02:56:45 +09:00

32 lines
735 B
PHP

<?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($env);
}
$result['action'] = $resultAction;
return $result;
}
}