protected function Core_Object_T_Signal_emit($__functionName, $__slotName, array $__parameters = [], array $__options = []) { $__options += ['return' => $__parameters, 'until' => null]; if(FALSE === $this->Core_Object_T_Signal_exists($__functionName, $__slotName)) return $__options['return']; $stack = &$this->__Core_Object_T_Signal_registry[$__functionName][$__slotName]; $results = &$this->__Core_Object_T_Signal_results[$__functionName][$__slotName]; $sender = [$this, $__functionName, $__slotName]; $result = $__parameters; foreach($stack as $slotPosition => $Delegate) { if(!isset($Delegate[0])) continue; $last = NULL; $resiverParams = array_merge($sender, [$Delegate[1]], $__parameters); $interfaces = class_implements($Delegate[0]); if($Delegate[0] === $this) { $last = $this->Core_Object_T_Invoke_method('Core_Object_T_Signal_reseive', $resiverParams); } else if((is_object($Delegate[0]) && $Delegate[0] instanceOf I_Signal) || (is_string($Delegate[0]) && isset($interfaces['ILLI\Core\StaticObject\I_Signal']))) { $last = Invoke::emit($Delegate[0], 'reseiveSignal', $resiverParams); } else { $last = isset($Delegate[1]) ? Invoke::emit($Delegate[0], $Delegate[1], $resiverParams) : Invoke::emit($Delegate[0], $resiverParams); } $results[$slotPosition] = $last; if($last === I_Signal::T_SIGNAL_EMIT_STOP) break; $result = $last; if(is_callable($__options['until'])) { if(TRUE === $__options['until']($result)) break; } } return $results; } protected function Core_Object_T_Signal_reseive($__sender, $__senderFunctionName, $__senderSlotName, $__function, array $__parameters = []) { return is_string($__function) ? $this->Core_Object_T_Invoke_method($__function, $__parameters) : Invoke::emiT_Callable($__function, [$__sender, $__senderFunctionName, $__senderSlotName, $__parameters]); }