Created
March 6, 2014 13:13
-
-
Save mitchellvanw/9389307 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php class D{private $ls = [];public function dispatch($es){if(!is_array($es)){$this->f($es);}foreach($es as $e){$this->f($e);}}public function listenOn($n,$l){$this->al($n,$l);}private function f($e){$ls=$this->gl($e->getName());if(!$ls)return;foreach($ls as $l){$l->handle($e);}}private function gl($n){if(!$this->hl($n))return;return $this->ls[$n];}private function hl($n){return isset($this->l[$n]);}private function al($n,$l){$this->ls[$n][] = $l;}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment