From 97d5f6807289cc4506926f970cd0a6c03e5bf7be Mon Sep 17 00:00:00 2001 From: hide_d Date: Sat, 8 Jun 2019 03:04:31 +0900 Subject: [PATCH] =?UTF-8?q?TriggerCaller=EC=97=90=20=EC=95=BD=EA=B0=84?= =?UTF-8?q?=EC=9D=98=20=EC=9C=A0=EC=97=B0=EC=84=B1=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/sammo/TriggerCaller.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/hwe/sammo/TriggerCaller.php b/hwe/sammo/TriggerCaller.php index 5ebf7731..ac9e506c 100644 --- a/hwe/sammo/TriggerCaller.php +++ b/hwe/sammo/TriggerCaller.php @@ -50,7 +50,7 @@ abstract class TriggerCaller{ } - function append(ObjectTrigger $trigger){ + function append(ObjectTrigger $trigger):self{ if(!$this->checkValidTrigger($trigger)){ throw new \InvalidArgumentException('Invalid Trigger Type'); } @@ -59,13 +59,13 @@ abstract class TriggerCaller{ if(!$this->triggerListByPriority){ $this->triggerListByPriority[$priority] = [$uniqueID=>$trigger]; - return; + return $this; } $lastKey = Util::array_last_key($this->triggerListByPriority); if($lastKey < $priority){ $this->triggerListByPriority[$priority] = [$uniqueID=>$trigger]; - return; + return $this; } if(key_exists($priority, $this->triggerListByPriority)){ @@ -74,11 +74,12 @@ abstract class TriggerCaller{ $this->triggerListByPriority[$priority] = [$uniqueID=>$trigger]; ksort($this->triggerListByPriority); + return $this; } - function merge(?TriggerCaller $other){ + function merge(?TriggerCaller $other):self{ if($other === null){ - return; + return $this; } //NOTE: array_merge로 계속 가야하는가? merge가 많으면 SPL의 LinkedList가 낫지 않나? @@ -114,6 +115,7 @@ abstract class TriggerCaller{ } $this->triggerListByPriority = $newTriggerList; + return $this; } function fire(?array $env = null, $arg = null):?array{