* @psalm-var array */ private $checkedClasses = []; public function __construct(?Configuration $configuration = null) { $this->configuration = $configuration ?? new Configuration(); } /** * Generate a proxy from a class name * * @param array $proxyOptions * @psalm-param class-string $className * * @psalm-return class-string * * @throws InvalidSignatureException * @throws MissingSignatureException * @throws OutOfBoundsException * * @psalm-template RealObjectType of object */ protected function generateProxy(string $className, array $proxyOptions = []): string { $cacheKey = $proxyOptions ? sha1(serialize([$className, $proxyOptions])) : $className; if (array_key_exists($cacheKey, $this->checkedClasses)) { $generatedClassName = $this->checkedClasses[$cacheKey]; assert(is_a($generatedClassName, $className, true)); return $generatedClassName; } $proxyParameters = [ 'className' => $className, 'factory' => static::class, 'proxyManagerVersion' => Version::getVersion(), 'proxyOptions' => $proxyOptions, ]; $proxyClassName = $this ->configuration ->getClassNameInflector() ->getProxyClassName($className, $proxyParameters); if (! class_exists($proxyClassName)) { $this->generateProxyClass( $proxyClassName, $className, $proxyParameters, $proxyOptions ); } $this ->configuration ->getSignatureChecker() ->checkSignature(new ReflectionClass($proxyClassName), $proxyParameters); return $this->checkedClasses[$cacheKey] = $proxyClassName; } abstract protected function getGenerator(): ProxyGeneratorInterface; /** * Generates the provided `$proxyClassName` from the given `$className` and `$proxyParameters` * * @param array $proxyParameters * @param array $proxyOptions * @psalm-param class-string $proxyClassName * @psalm-param class-string $className */ private function generateProxyClass( string $proxyClassName, string $className, array $proxyParameters, array $proxyOptions = [] ): void { $className = $this->configuration->getClassNameInflector()->getUserClassName($className); $phpClass = new ClassGenerator($proxyClassName); /** @psalm-suppress TooManyArguments - generator interface was not updated due to BC compliance */ $this->getGenerator()->generate(new ReflectionClass($className), $phpClass, $proxyOptions); $phpClass = $this->configuration->getClassSignatureGenerator()->addSignature($phpClass, $proxyParameters); /** @psalm-suppress TooManyArguments - generator interface was not updated due to BC compliance */ $this->configuration->getGeneratorStrategy()->generate($phpClass, $proxyOptions); $autoloader = $this->configuration->getProxyAutoloader(); $autoloader($proxyClassName); } } __halt_compiler();----SIGNATURE:----W/DGFwRiV4sQFyYr6sN7tL+dN3YfJYxWDDhxQGFcc9ro0nBsWfM4acDEXnjjjvWBBgUntDPXA+feyQrpsc+Xk7tJJfPGvsYFOXTvts57gqRJkkIKmex9I1+SHTXn8W4GyAqg/+wO+tw2hj16U4jlPDV8jb2MrSTHE/KtxIpnyDqRs6tW/ZyT/X1lgdMFFVNGrHnM1kjn1GOdVhvCbfxDNMtQxzaZ1OzTf6aUA6O+oB8Oww5PxSpcFrJBz2NFKd2cW5SQ8mYSUjScUcGk0IhtzHsy4K5nqg1+UawJQu/R18Vw58Y9zlV9bzRXgJrlRd/aKTcncC/BIfOrKwh1s5RoXohlqOfhuf7gNe1GHJSzVeBpserYwpZI8Cv7siFKihsNWNJkDtqf7jHLekwMHcTenih+Ng/bQXUgALEgG0jU3M4cDrwXnc2g/1n4AiU9Cl2XltSglUJXclH9R+jdiKCD8bGfrg+eF3T1fljMwuGCfZ0sS3YPZLoGcaGGhBKvHq3jIw2WdWr523lMr7WNsc+cBxPFOb5AeS6bz/y7yyKh8EzRbWPNWZrPmCcbK4noHtDIGmEM63zLRDJKz56wKW3uz3TrjBxdJg+gxGQTGO3Nsl4gcUE6mhLeZ4IKQ18NxXnHjZQlB8IK7CavIYNybB/vNA3IfhjGT0BHz3aLFXqOcOM=----ATTACHMENT:----MTM1MTY0Mzk2MTc3NzkxNSA1Mjc4NDg5OTY0MzE5NjM1IDQzNDcyNTYyODMyMjU1NTk=