vendor/codeages/biz-framework/src/Targetlog/Annotation/LogReader.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace Codeages\Biz\Framework\Targetlog\Annotation;
use Doctrine\Common\Annotations\AnnotationReader;
use Symfony\Component\Filesystem\Filesystem;
class LogReader
{
public function __construct($cacheDirectory = null)
{
$this->cacheDirectory = $cacheDirectory;
if ($cacheDirectory) {
$fs = new Filesystem();
$fs->mkdir($cacheDirectory);
}
}
public function read($service)
{
$cache = $this->readCache($service);
if ($cache) {
return $cache;
}
$reflectClass = new \ReflectionClass($service);
$interfaces = $reflectClass->getInterfaces();
$interceptorData = $this->handleInterface($interfaces);
$this->saveCache($service, $interceptorData);
return $interceptorData;
}
protected function handleInterface($interfaces)
{
$annotationReader = new AnnotationReader();
$annotationReader::addGlobalIgnoredName('before');
$interceptorData = array();
foreach ($interfaces as $interfaceName => $interfaceObj) {
$reflectInterface = new \ReflectionClass($interfaceName);
$methods = $reflectInterface->getMethods();
$getInterceptorData = $this->getInterceptorData($annotationReader, $methods);
if (!empty($getInterceptorData)) {
$interceptorData = array_merge($interceptorData, $getInterceptorData);
}
}
return $interceptorData;
}
protected function getInterceptorData($annotationReader, $methods)
{
$interceptorData = array();
foreach ($methods as $method) {
$annotation = $annotationReader->getMethodAnnotation($method, 'Codeages\Biz\Framework\TargetLog\Annotation\Log');
if (empty($annotation)) {
$interceptorData[$method->getName()] = array();
continue;
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。