src/Biz/System/Annotation/LogReader.php
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace Biz\System\Annotation;
use Doctrine\Common\Annotations\AnnotationReader;
use Symfony\Component\Filesystem\Filesystem;
class LogReader
{
public function __construct($cacheDirectory = null)
{
$this->cacheDirectory = $cacheDirectory;
$this->initCacheDir();
}
public function read($service)
{
$cache = $this->readCache($service);
if ($cache) {
return $cache;
}
$annotationReader = new AnnotationReader();
$annotationReader::addGlobalIgnoredName('before');
$reflectClass = new \ReflectionClass($service);
$interfaces = $reflectClass->getInterfaces();
$interceptorData = array();
foreach ($interfaces as $interfaceName => $interfaceObj) {
$reflectInterface = new \ReflectionClass($interfaceName);
$methods = $reflectInterface->getMethods();
$nameSpaceKey = self::getServiceNameSpaceKey($reflectInterface->getNamespaceName());
$name = self::getServiceName($interfaceName);
foreach ($methods as $method) {
$annotation = $annotationReader->getMethodAnnotation($method, '\Biz\System\Annotation\Log');
$ReflectionFunc = new \ReflectionMethod($interfaceName, $method->name);
$parameters = $ReflectionFunc->getParameters();
$funcParam = array();
foreach ($parameters as $parameter) {
$funcParam[] = $parameter->name;
}
if (empty($annotation)) {
$interceptorData[$method->getName()] = array();
continue;
}
$log = array();
$log['module'] = $annotation->getModule();
$log['action'] = $annotation->getAction();
$log['param'] = $annotation->getParam();
$log['postfix'] = $annotation->getPostfix();
$log['funcName'] = $annotation->getFuncName();
$log['funcParam'] = $funcParam;
$serviceName = $annotation->getServiceName();
if (!empty($serviceName)) {
$log['service'] = $serviceName;
} else {
$log['service'] = $nameSpaceKey.':'.$name;
}
$interceptorData[$method->getName()] = $log;
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。