Linux unitednationsplay.com 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64
nginx/1.20.1
Server IP : 188.130.139.92 & Your IP : 3.140.248.104
Domains :
Cant Read [ /etc/named.conf ]
User : web
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
home /
www /
wb /
vendor /
jms /
metadata /
src /
Delete
Unzip
Name
Size
Permission
Date
Action
Cache
[ DIR ]
drwxrwxr-x
2021-11-22 12:27
Driver
[ DIR ]
drwxrwxr-x
2021-11-22 12:27
AdvancedMetadataFactoryInterface.php
509
B
-rw-rw-r--
2021-11-22 12:27
ClassHierarchyMetadata.php
904
B
-rw-rw-r--
2021-11-22 12:27
ClassMetadata.php
2
KB
-rw-rw-r--
2021-11-22 12:27
MergeableClassMetadata.php
821
B
-rw-rw-r--
2021-11-22 12:27
MergeableInterface.php
148
B
-rw-rw-r--
2021-11-22 12:27
MetadataFactory.php
5.94
KB
-rw-rw-r--
2021-11-22 12:27
MetadataFactoryInterface.php
915
B
-rw-rw-r--
2021-11-22 12:27
MethodMetadata.php
1.75
KB
-rw-rw-r--
2021-11-22 12:27
NullMetadata.php
223
B
-rw-rw-r--
2021-11-22 12:27
PropertyMetadata.php
845
B
-rw-rw-r--
2021-11-22 12:27
SerializationHelper.php
688
B
-rw-rw-r--
2021-11-22 12:27
Save
Rename
<?php declare(strict_types=1); namespace Metadata; use Metadata\Cache\CacheInterface; use Metadata\Driver\AdvancedDriverInterface; use Metadata\Driver\DriverInterface; class MetadataFactory implements AdvancedMetadataFactoryInterface { /** * @var DriverInterface */ private $driver; /** * @var CacheInterface */ private $cache; /** * @var ClassMetadata[] */ private $loadedMetadata = []; /** * @var ClassMetadata[] */ private $loadedClassMetadata = []; /** * @var string|null */ private $hierarchyMetadataClass; /** * @var bool */ private $includeInterfaces = false; /** * @var bool */ private $debug = false; public function __construct(DriverInterface $driver, ?string $hierarchyMetadataClass = 'Metadata\ClassHierarchyMetadata', bool $debug = false) { $this->driver = $driver; $this->hierarchyMetadataClass = $hierarchyMetadataClass; $this->debug = $debug; } public function setIncludeInterfaces(bool $include): void { $this->includeInterfaces = $include; } public function setCache(CacheInterface $cache): void { $this->cache = $cache; } /** * {@inheritDoc} */ public function getMetadataForClass(string $className) { if (isset($this->loadedMetadata[$className])) { return $this->filterNullMetadata($this->loadedMetadata[$className]); } $metadata = null; foreach ($this->getClassHierarchy($className) as $class) { if (isset($this->loadedClassMetadata[$name = $class->getName()])) { if (null !== $classMetadata = $this->filterNullMetadata($this->loadedClassMetadata[$name])) { $this->addClassMetadata($metadata, $classMetadata); } continue; } // check the cache if (null !== $this->cache) { if (($classMetadata = $this->cache->load($class->getName())) instanceof NullMetadata) { $this->loadedClassMetadata[$name] = $classMetadata; continue; } if (null !== $classMetadata) { if (!$classMetadata instanceof ClassMetadata) { throw new \LogicException(sprintf( 'The cache must return instances of ClassMetadata for class %s, but got %s.', $className, var_export($classMetadata, true) )); } if ($this->debug && !$classMetadata->isFresh()) { $this->cache->evict($classMetadata->name); } else { $this->loadedClassMetadata[$name] = $classMetadata; $this->addClassMetadata($metadata, $classMetadata); continue; } } } // load from source if (null !== $classMetadata = $this->driver->loadMetadataForClass($class)) { $this->loadedClassMetadata[$name] = $classMetadata; $this->addClassMetadata($metadata, $classMetadata); if (null !== $this->cache) { $this->cache->put($classMetadata); } continue; } if (null !== $this->cache && !$this->debug) { $this->cache->put(new NullMetadata($class->getName())); } } if (null === $metadata) { $metadata = new NullMetadata($className); } return $this->filterNullMetadata($this->loadedMetadata[$className] = $metadata); } /** * {@inheritDoc} */ public function getAllClassNames(): array { if (!$this->driver instanceof AdvancedDriverInterface) { throw new \RuntimeException( sprintf('Driver "%s" must be an instance of "AdvancedDriverInterface".', get_class($this->driver)) ); } return $this->driver->getAllClassNames(); } /** * @param MergeableInterface|ClassHierarchyMetadata $metadata */ private function addClassMetadata(&$metadata, ClassMetadata $toAdd): void { if ($toAdd instanceof MergeableInterface) { if (null === $metadata) { $metadata = clone $toAdd; } else { $metadata->merge($toAdd); } } else { if (null === $metadata) { $class = $this->hierarchyMetadataClass; $metadata = new $class(); } $metadata->addClassMetadata($toAdd); } } /** * @return \ReflectionClass[] */ private function getClassHierarchy(string $class): array { $classes = []; $refl = new \ReflectionClass($class); do { $classes[] = $refl; $refl = $refl->getParentClass(); } while (false !== $refl); $classes = array_reverse($classes, false); if (!$this->includeInterfaces) { return $classes; } $addedInterfaces = []; $newHierarchy = []; foreach ($classes as $class) { foreach ($class->getInterfaces() as $interface) { if (isset($addedInterfaces[$interface->getName()])) { continue; } $addedInterfaces[$interface->getName()] = true; $newHierarchy[] = $interface; } $newHierarchy[] = $class; } return $newHierarchy; } /** * @param ClassMetadata|ClassHierarchyMetadata|MergeableInterface $metadata * * @return ClassMetadata|ClassHierarchyMetadata|MergeableInterface */ private function filterNullMetadata($metadata = null) { return !$metadata instanceof NullMetadata ? $metadata : null; } }