vendor/codeages/biz-framework/src/Targetlog/Interceptor/AnnotationInterceptor.php

(开头部分) 1KB

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

<?php

namespace Codeages\Biz\Framework\Targetlog\Interceptor;

use Codeages\Biz\Framework\Context\AbstractInterceptor;
use Codeages\Biz\Framework\Context\Biz;
use Codeages\Biz\Framework\Targetlog\Annotation\Log;
use Codeages\Biz\Framework\Targetlog\Service\TargetlogService;

class AnnotationInterceptor extends AbstractInterceptor
{
    /**
     * @var Biz
     */
    protected $biz;

    /**
     * @var log
     */
    protected $log;

    /**
     * AnnotationInterceptor constructor.
     *
     * @param Biz $biz
     * @param $className
     *
     * @throws \Doctrine\Common\Annotations\AnnotationException
     * @throws \ReflectionException
     */
    public function __construct(Biz $biz, $className)
    {
        $this->biz = $biz;
        $this->interceptorData = $biz['service_targetlog.annotation_reader']->read($className);
    }

    /**
     * @param $funcName
     * @param $args
     *
     * @return array
     */
    public function beforeExec($funcName, $args)
    {
        $result = array();
        if (!empty($this->interceptorData[$funcName])) {
            $log = $this->interceptorData[$funcName];
            $formats = $log['format'];
            if (!empty($formats)) {
                $formats = str_replace("'", '"', $formats);
                $formats = json_decode($formats, true);
                if (isset($formats['before'])) {
                    $format = $formats['before'];
                    $service = $this->biz->service($format['className']);
                    $formatFuncName = $format['funcName'];
                    $arguments = $this->getArrayValue($log['funcParam'], $format['param'], $args);
                    $formatReturn = $service->$formatFuncName($arguments[0]);
                    $result = $formatReturn;
                }
            }

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

AI 解读 AI

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

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