public function attachHandler($name, callable $callback, $once = false)
    {
        if (! isset($this->events[$name])) {
            if (strpos($name, '.') === false) {
                throw new InvalidEventException(
                    'Event subject "' . $this->subjectClass
                    . '" does not have event "' . $name . '"'
                );
            }
            $this->events[$name] = array();
        }
        if ($once) {
            $temp = function ($event) use ($name, $callback, &$temp) {
                $ret = call_user_func($callback, $event);
                $this->detachHandler($name, $temp);
                return $ret;
            };
            $this->events[$name][] = $temp;
        } else {
            $this->events[$name][] = $callback;
        }
    }