设置点击事件及标记
@param $arg
@return $this
439600
public function setKey($arg) {
        $this->setType(self::CLICK);
        $this->key = $arg;
        return $this;
    }
888424
public function _dispatch($event, $args = array())
    {
        if($event != "onLog") {
            Log::d("Event " . $event, array('events'));
        }
        $eventResult = new EventResult();
        global $context;
        $buffer = array();
        if (!is_array($args)) {
            $args = array($args);
        }
        if (isset($this->handlers[$event]) && count($this->handlers[$event]) > 0) {
            $handlers = $this->handlers[$event];
            foreach ($handlers as $item) {
                $eventResult->addHandler($item);
                $result = $item->run($args);
                if($result !== false) {
                    $eventResult->addResult($result, $item);
                }
            }
        }
        return $eventResult;
    }
521073
public function removeArgument($arg)
    {
        if ($this->hasArgument($arg)) {
            $this->arguments->remove($arg);
        }
        return $this;
    }
145548
public function setArgument(Argument $arg)
    {
        if ($this->mode == GetOpt::NO_ARGUMENT) {
            throw new \InvalidArgumentException("Option should not have any argument");
        }
        $this->argument = clone $arg; // he can reuse his arg but we need a unique arg
        $this->argument->multiple($this->mode === GetOpt::MULTIPLE_ARGUMENT);
        $this->argument->setOption($this);
        return $this;
    }
827741
public function eventCall($arg)
    {
        try {
            if ($this->state === Generic::STATE_FINISHED) {
                $this->finish();
                $this->free();
                return;
            }
            $this->state = Generic::STATE_RUNNING;
            $this->onWakeup();
            $throw = false;
            try {
                $ret = $this->run();
                if (($ret === Generic::STATE_FINISHED) || ($ret === null)) {
                    $this->finish();
                } elseif ($ret === Generic::STATE_WAITING) {
                    $this->state = $ret;
                }
            } catch (RequestSleep $e) {
                $this->state = Generic::STATE_WAITING;
            } catch (RequestTerminated $e) {
                $this->state = Generic::STATE_FINISHED;
            } catch (\Exception $e) {
                if (!$this->handleException($e)) {
                    $throw = true;
                }
            }
            if ($this->state === Generic::STATE_FINISHED) {
                $this->finish();
            }
            $this->onSleep();
            if ($throw) {
                throw $e;
            }
        } catch (\Exception $e) {
            Daemon::uncaughtExceptionHandler($e);
            $this->finish();
            return;
        }
        if ($this->state === Generic::STATE_WAITING) {
            $this->ev->add($this->sleepTime);
        }
    }
418141
public function on(...$args)
    {
        $this->createToken(
            'AND',
            $args,
            $this->joinTokens[$this->activeJoin]['on'],
            $this->onWrapper()
        );

        return $this;
    }
174872
public function listen($args = null)
    {
        if ('action' === $this->getModel()->getType()) {
            return do_action($this->getModel()->getIdentifier(), $args);
        }

        return apply_filters($this->getModel()->getIdentifier(), $args);
    }
69932
public function trigger($events, $args = [])
    {
        $args[] = $this;
        if (!is_array($events)) {
            $events = [$events];
        }

        foreach ($events as $event) {
            dispatcher()->trigger(static::class . '.' . $event, $args);
            dispatcher()->trigger(Record::class . '.' . $event, $args);
        }

        return $this;
    }
1191091
public function setMenu($arg) {
        if (is_array($arg)) {
            $this->menu = $arg;
        } else {
            $this->menu[] = $arg;
        }
        return $this;
    }
398713
public function setArgument(Argument $arg)
    {
        if ($this->mode == Getopt::NO_ARGUMENT) {
            throw new \InvalidArgumentException("Option should not have any argument");
        }
        $this->argument = $arg;
        return $this;
    }
85787
public function triggerEvent($event, $args = [])
    {
        if (!($event instanceof EventInterface)) {
            if (isset($this->events[$event])) {
                $event = $this->events[$event];
            } else {
                $event = new Event($event);
            }
        }

        $event->mergeArguments($args);

        if (isset($this->listeners[$event->getName()])) {
            foreach ($this->listeners[$event->getName()] as $listener) {
                if ($event->isStopped()) {
                    return $event;
                }

                if (is_callable($listener)) {
                    call_user_func($listener, $event);
                } else {
                    call_user_func([$listener, $event->getName()], $event);
                }
            }
        }

        return $event;
    }
878955
public function orHaving(...$args): self
    {
        $this->createToken('OR', $args, $this->havingTokens, $this->havingWrapper());

        return $this;
    }
521079
public function setAI($arg) {
        $this->aiBegin = max($this->aiBegin, intval($arg));
        return $this;
    }
1220580
public function prependArg($arg)
    {
        Assertion::string($arg);
        $this->args = $this->args->prepend($arg);
    }
138512
protected function callback($callback, array $args = [])
    {
        if (isset($callback)) {
            if (is_callable($callback) && $callback instanceof \Closure) {
                // Set new object and append the callback with some data.
                $o = new \ArrayObject($args);
                $o->app = App::instance();
                $callback = $callback->bindTo($o);
            } elseif (is_string($callback) && strpos($callback, '@') !== false) {
                $fixcallback = explode('@', $callback, 2);
                $this->Controller = $fixcallback[0];

                if (is_callable(
                    $callback = [$fixcallback[0], (isset($fixcallback[1]) ? $fixcallback[1] : 'index')]
                )) {
                    $this->Method = $callback[1];
                } else {
                    throw new \Exception("Callable error on {$callback[0]} -> {$callback[1]} !");
                }
            }

            if (is_array($callback) && !is_object($callback[0])) {
                $callback[0] = new $callback[0];
            }

            if (isset($args[0]) && $args[0] == $this->fullArg) {
                array_shift($args);
            }

            // Finally, call the method.
            return call_user_func_array($callback, $args);
        }
        return false;
    }
388797
public function data($args)
    {
        foreach (func_get_args() as $arg) {
            if (is_array($arg)) {
                $this->data = array_merge_recursive($arg, $this->data);
            } else {
                $this->data[] = $arg;
            }
        }

        return $this;
    }
284131
public function event($event, ...$args){
        if($this->eventManager !== null){
            return $this->eventManager->trigger($event, $args);
        }

        return false;
    }