vendor/codeages/biz-framework/src/Service/ServiceProxy.php

(开头部分) 1KB

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

<?php

namespace Codeages\Biz\Framework\Service;

use Codeages\Biz\Framework\Context\Biz;

class ServiceProxy
{
    private $biz;
    private $className;
    private $class;
    private $interceptors;
    private $interceptorDatas = array();

    public function __construct(Biz $biz, $className)
    {
        $this->biz = $biz;
        $this->className = $className;
        $this->class = new $className($biz);
        $this->handleInterceptors();
    }

    public function __call($funcName, $arguments)
    {
        $beforeResult = array();
        foreach ($this->interceptorDatas as $interceptorName => $interceptorData) {
            if (!empty($interceptorData[$funcName])) {
                try {
                    $beforeResult = $this->interceptors[$interceptorName]->beforeExec($funcName, $arguments);
                } catch (\Exception $exception) {
                    throw $exception;
                }
            }
        }

        $result = call_user_func_array(array($this->class, $funcName), $arguments);

        foreach ($this->interceptorDatas as $interceptorName => $interceptorData) {
            if (!empty($interceptorData[$funcName])) {
                $this->interceptors[$interceptorName]->afterExec($funcName, $arguments, $result, $beforeResult);
            }
        }

        return $result;
    }

    public function getClassName()
    {
        return $this->className;
    }

    public function getClass()
    {
        return $this->class;
    }

    public function handleInterceptors()
    {
        $biz = $this->biz;
        foreach ($biz['interceptors'] as $name => $interceptor) {

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

AI 解读 AI

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

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