// app/Plugin/Api42/DependencyInjection/Compiler/ApiCompilerPass.php namespace Plugin\Api42\DependencyInjection\Compiler; use Plugin\Api42\Service\WebHookEvents; use Plugin\Api42\Service\WebHookTrigger; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Reference; class ApiCompilerPass implements CompilerPassInterface { public function process(ContainerBuilder $container) { $this->configureTrigger($container); $this->configureAllowList($container); $this->configureKeyPair($container); $this->configureSchema($container); $plugins = $container->getParameter('eccube.plugins.enabled'); if (!in_array('Api42', $plugins)) { if ($container->hasDefinition('League\Bundle\OAuth2ServerBundle\EventListener\AddClientDefaultScopesListener')) { $def = $container->getDefinition('League\Bundle\OAuth2ServerBundle\EventListener\AddClientDefaultScopesListener'); $def->clearTags(); } } } private function configureSchema(ContainerBuilder $container) { $queriesServiceDef = $container->getDefinition('api.queries'); $mutationsServiceDef = $container->getDefinition('api.mutations'); foreach ($container->getDefinitions() as $id => $definition) { if (is_subclass_of($definition->getClass(), Query::class)) { $queriesServiceDef->addMethodCall('append', [new Reference($id)]); } if (is_subclass_of($definition->getClass(), Mutation::class)) { $mutationsServiceDef->addMethodCall('append', [new Reference($id)]); } } } private function configureTrigger(ContainerBuilder $container) { if ($container->hasDefinition(WebHookEvents::class)) { $serviceDef = $container->getDefinition(WebHookEvents::class); foreach ($container->getDefinitions() as $id => $definition) { if (is_subclass_of($definition->getClass(), WebHookTrigger::class)) { $serviceDef->addMethodCall('addTrigger', [new Reference($id)]); } } } } private function configureAllowList(ContainerBuilder $container) { $ids = $container->findTaggedServiceIds('eccube.api.allow_list'); $typesDef = $container->getDefinition(Types::class); foreach ($ids as $id => $tags) { $definition = $container->getDefinition($id); $definition->setClass(AllowList::class); $typesDef->addMethodCall('addAllowList', [new Reference($id)]); } } private function configureKeyPair(ContainerBuilder $container) { $projectDir = $container->getParameter('kernel.project_dir'); $oauthConfig = $container->getExtensionConfig('league_oauth2_server'); $oauthConfig = $container->resolveEnvPlaceholders($oauthConfig, true); $privateKey = str_replace('%%kernel.project_dir%%', $projectDir, $oauthConfig[0]['authorization_server']['private_key']); $publicKey = str_replace('%%kernel.project_dir%%', $projectDir, $oauthConfig[0]['resource_server']['public_key']); if (!$this->isRSAKeyContent($privateKey) && !file_exists($privateKey) && !$this->isRSAKeyContent($publicKey) && !file_exists($publicKey)) { $this->generateKeys($privateKey, $publicKey); } } private function isRSAKeyContent($string) { return preg_match(CryptKey::RSA_KEY_PATTERN, $string); } private function generateKeys($privateKeyPath, $publicKeyPath) { if (false === function_exists('openssl_pkey_new')) { throw new \RuntimeException('OpenSSL extension not available'); } $res = openssl_pkey_new([ 'digest_alg' => 'sha512', 'private_key_bits' => 4096, 'private_key_type' => OPENSSL_KEYTYPE_RSA, ]); openssl_pkey_export($res, $privateKey); $publicKey = openssl_pkey_get_details($res)['key']; foreach ([$privateKeyPath, $publicKeyPath] as $file) { $dir = dirname($file); if (!file_exists($dir) && !mkdir($dir, 0755, true) && !is_dir($dir)) { throw new \RuntimeException(sprintf('Directory "%s" was not created', $dir)); } } if (false === file_put_contents($privateKeyPath, $privateKey)) { throw new \RuntimeException(sprintf('File "%s" was not created', $privateKeyPath)); } if (false === file_put_contents($publicKeyPath, $publicKey)) { throw new \RuntimeException(sprintf('File "%s" was not created', $publicKeyPath)); } } } The autoloader expected class "Plugin\Api42\DependencyInjection\Compiler\ApiCompilerPass" to be defined in file "/home/brully666/terminal999.site/public_html/vendor/composer/../../app/Plugin/Api42/DependencyInjection/Compiler/ApiCompilerPass.php". The file was found but the class was not in it, the class name or namespace probably has a typo. (500 Internal Server Error)

Symfony Exception

RuntimeException

HTTP 500 Internal Server Error

The autoloader expected class "Plugin\Api42\DependencyInjection\Compiler\ApiCompilerPass" to be defined in file "/home/brully666/terminal999.site/public_html/vendor/composer/../../app/Plugin/Api42/DependencyInjection/Compiler/ApiCompilerPass.php". The file was found but the class was not in it, the class name or namespace probably has a typo.

Exception

RuntimeException

  1.         if (!$exists) {
  2.             if (false !== strpos($class'/')) {
  3.                 throw new \RuntimeException(sprintf('Trying to autoload a class with an invalid name "%s". Be careful that the namespace separator is "\" in PHP, not "/".'$class));
  4.             }
  5.             throw new \RuntimeException(sprintf('The autoloader expected class "%s" to be defined in file "%s". The file was found but the class was not in it, the class name or namespace probably has a typo.'$class$file));
  6.         }
  7.         if (self::$caseCheck && $message $this->checkCase($refl$file$class)) {
  8.             throw new \RuntimeException(sprintf('Case mismatch between class and real file names: "%s" vs "%s" in "%s".'$message[0], $message[1], $message[2]));
  9.         }
  1.             }
  2.         } finally {
  3.             error_reporting($e);
  4.         }
  5.         $this->checkClass($class$file);
  6.     }
  7.     private function checkClass(string $classstring $file null): void
  8.     {
  9.         $exists null === $file || class_exists($classfalse) || interface_exists($classfalse) || trait_exists($classfalse);
DebugClassLoader->loadClass('Plugin\\Api42\\DependencyInjection\\Compiler\\ApiCompilerPass') in /home/brully666/terminal999.site/public_html/app/Plugin/Api42/Bundle/ApiBundle.php (line 28)
  1. {
  2.     public function build(ContainerBuilder $container)
  3.     {
  4.         parent::build($container);
  5.         $container->addCompilerPass(new ApiCompilerPass());
  6.     }
  7.     public function getContainerExtension(): ?ExtensionInterface
  8.     {
  9.         return new ApiExtension();
  1.                 $container->addObjectResource($bundle);
  2.             }
  3.         }
  4.         foreach ($this->bundles as $bundle) {
  5.             $bundle->build($container);
  6.         }
  7.         $this->build($container);
  8.         foreach ($container->getExtensions() as $extension) {
  1.             }
  2.         }
  3.         $container $this->getContainerBuilder();
  4.         $container->addObjectResource($this);
  5.         $this->prepareContainer($container);
  6.         if (null !== $cont $this->registerContainerConfiguration($this->getContainerLoader($container))) {
  7.             trigger_deprecation('symfony/http-kernel''5.3''Returning a ContainerBuilder from "%s::registerContainerConfiguration()" is deprecated.'get_debug_type($this));
  8.             $container->merge($cont);
  9.         }
  1.             });
  2.         }
  3.         try {
  4.             $container null;
  5.             $container $this->buildContainer();
  6.             $container->compile();
  7.         } finally {
  8.             if ($collectDeprecations) {
  9.                 restore_error_handler();
  1.             $_ENV['SHELL_VERBOSITY'] = 3;
  2.             $_SERVER['SHELL_VERBOSITY'] = 3;
  3.         }
  4.         $this->initializeBundles();
  5.         $this->initializeContainer();
  6.         $container $this->container;
  7.         if ($container->hasParameter('kernel.trusted_hosts') && $trustedHosts $container->getParameter('kernel.trusted_hosts')) {
  8.             Request::setTrustedHosts($trustedHosts);
  1.      * {@inheritdoc}
  2.      */
  3.     public function handle(Request $requestint $type HttpKernelInterface::MAIN_REQUESTbool $catch true)
  4.     {
  5.         if (!$this->booted) {
  6.             $container $this->container ?? $this->preBoot();
  7.             if ($container->has('http_cache')) {
  8.                 return $container->get('http_cache')->handle($request$type$catch);
  9.             }
  10.         }
Kernel->handle(object(Request)) in /home/brully666/terminal999.site/public_html/index.php (line 83)
  1.         }
  2.     }
  3. }
  4. $kernel = new Kernel($env$debug);
  5. $response $kernel->handle($request);
  6. $response->send();
  7. $kernel->terminate($request$response);

Stack Trace

RuntimeException
RuntimeException:
The autoloader expected class "Plugin\Api42\DependencyInjection\Compiler\ApiCompilerPass" to be defined in file "/home/brully666/terminal999.site/public_html/vendor/composer/../../app/Plugin/Api42/DependencyInjection/Compiler/ApiCompilerPass.php". The file was found but the class was not in it, the class name or namespace probably has a typo.

  at /home/brully666/terminal999.site/public_html/vendor/symfony/error-handler/DebugClassLoader.php:343
  at Symfony\Component\ErrorHandler\DebugClassLoader->checkClass('Plugin\\Api42\\DependencyInjection\\Compiler\\ApiCompilerPass', '/home/brully666/terminal999.site/public_html/vendor/composer/../../app/Plugin/Api42/DependencyInjection/Compiler/ApiCompilerPass.php')
     (/home/brully666/terminal999.site/public_html/vendor/symfony/error-handler/DebugClassLoader.php:300)
  at Symfony\Component\ErrorHandler\DebugClassLoader->loadClass('Plugin\\Api42\\DependencyInjection\\Compiler\\ApiCompilerPass')
     (/home/brully666/terminal999.site/public_html/app/Plugin/Api42/Bundle/ApiBundle.php:28)
  at Plugin\Api42\Bundle\ApiBundle->build(object(ContainerBuilder))
     (/home/brully666/terminal999.site/public_html/vendor/symfony/http-kernel/Kernel.php:676)
  at Symfony\Component\HttpKernel\Kernel->prepareContainer(object(ContainerBuilder))
     (/home/brully666/terminal999.site/public_html/vendor/symfony/http-kernel/Kernel.php:647)
  at Symfony\Component\HttpKernel\Kernel->buildContainer()
     (/home/brully666/terminal999.site/public_html/vendor/symfony/http-kernel/Kernel.php:545)
  at Symfony\Component\HttpKernel\Kernel->initializeContainer()
     (/home/brully666/terminal999.site/public_html/vendor/symfony/http-kernel/Kernel.php:787)
  at Symfony\Component\HttpKernel\Kernel->preBoot()
     (/home/brully666/terminal999.site/public_html/vendor/symfony/http-kernel/Kernel.php:190)
  at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
     (/home/brully666/terminal999.site/public_html/index.php:83)