src/Topxia/MobileBundleV2/Processor/ProcessorDelegator.php

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php

namespace Topxia\MobileBundleV2\Processor;

class ProcessorDelegator
{
    private $target;
    private $invokeArray;

    public function __construct($target)
    {
        $this->invokeArray = array();
        $this->target = $target;
    }

    public function __call($name, $arguments)
    {
        if (!method_exists($this->target, $name)) {
            return array('error' => 'method not exists');
        }
        if (method_exists($this, $name) || $this->filterMethod($name)) {
            return array('error' => 'the method is serviceDelegator');
        }

        return $this->invokeFunction($name, $arguments);
    }

    public function stopInvoke()
    {
        $this->invokeArray = array();
    }

    private function invokeFunction($name, $arguments)
    {
        $functionResult = array();
        array_push($this->invokeArray, 'before', $name, 'after');
        while ($function = array_pop($this->invokeArray)) {
            $result = call_user_func(array($this->target, $function), $arguments);
            if ($result != null) {
                $functionResult = $result;
            }
        }

        return $functionResult;
    }

    private $methodFilters = array(
        '__construct',
        'after',
        'before',
    );

    private function filterMethod($method)
    {
        return in_array($method, $this->methodFilters);
    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。