vendor/codeages/biz-framework/src/Dao/Annotation/AnnotationCacheBuilder.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace Codeages\Biz\Framework\Dao\Annotation;
use Composer\Autoload\ClassLoader;
use Doctrine\Common\Annotations\AnnotationReader;
use Symfony\Component\Finder\Finder;
class AnnotationCacheBuilder
{
protected $loader;
public function __construct(ClassLoader $loader)
{
$this->loader = $loader;
}
public function build(array $namespaces)
{
foreach ($namespaces as $namespace) {
$this->scanNamespace($namespace);
}
}
public function scanNamespace($namespace)
{
$cache = array();
$reader = new AnnotationReader();
$directories = $this->getNamespaceDirectories($namespace);
foreach ($directories as $directory) {
$finder = new Finder();
$finder->in($directory);
foreach ($finder->files()->name('*.php') as $file) {
$class = $namespace.'\\'.str_replace(DIRECTORY_SEPARATOR, '\\', substr($file->getRelativePathname(), 0, -4));
$classRef = new \ReflectionClass($class);
$isDao = $classRef->implementsInterface('Codeages\Biz\Framework\Dao\DaoInterface');
if (!$isDao) {
continue;
}
$annotation = $reader->getClassAnnotation($classRef, 'Codeages\Biz\Framework\Dao\Annotation\CacheStrategy');
if (empty($annotation)) {
continue;
}
$cache[$class] = array(
'strategy' => $annotation->getName(),
'update_rel_fields' => array(),
'methods' => array(),
);
$methodRefs = $classRef->getMethods(\ReflectionMethod::IS_PUBLIC);
foreach ($methodRefs as $methodRef) {
$annotation = $reader->getMethodAnnotation($methodRef, 'Codeages\Biz\Framework\Dao\Annotation\RowCache');
if (empty($annotation)) {
continue;
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。