:$strategies; } /** * Append a strategy at the end of the strategy queue. * * @param string $strategy Fully qualified class name of a DiscoveryStrategy */ public static function appendStrategy($strategy) { self::$strategies[] = $strategy; self::clearCache(); } /** * Prepend a strategy at the beginning of the strategy queue. * * @param string $strategy Fully qualified class name to a DiscoveryStrategy */ public static function prependStrategy($strategy) { array_unshift(self::$strategies, $strategy); self::clearCache(); } public static function clearCache() { self::$cache = []; } /** * Evaluates conditions to boolean. * * @return bool */ protected static function evaluateCondition($condition) { if (is_string($condition)) { // Should be extended for functions, extensions??? return self::safeClassExists($condition); } if (is_callable($condition)) { return (bool) $condition(); } if (is_bool($condition)) { return $condition; } if (is_array($condition)) { foreach ($condition as $c) { if (\false === static::evaluateCondition($c)) { // Immediately stop execution if the condition is false return \false; } } return \true; } return \false; } /** * Get an instance of the $class. * * @param string|\Closure $class a FQCN of a class or a closure that instantiate the class * * @return object * * @throws ClassInstantiationFailedException */ protected static function instantiateClass($class) { try { if (is_string($class)) { return new $class(); } if (is_callable($class)) { return $class(); } } catch (\Exception $e) { throw new ClassInstantiationFailedException('Unexpected exception when instantiating class.', 0, $e); } throw new ClassInstantiationFailedException('Could not instantiate class because parameter is neither a callable nor a string'); } /** * We need a "safe" version of PHP's "class_exists" because Magento has a bug * (or they call it a "feature"). Magento is throwing an exception if you do class_exists() * on a class that ends with "Factory" and if that file does not exits. * * This function catches all potential exceptions and makes sure to always return a boolean. * * @param string $class * * @return bool */ public static function safeClassExists($class) { try { return class_exists($class) || interface_exists($class); } catch (\Exception $e) { return \false; } } }
Fatal error: Uncaught Error: Class "WordPress\AiClientDependencies\Http\Discovery\ClassDiscovery" not found in /htdocs/emploitogo.info/wp-includes/php-ai-client/third-party/Http/Discovery/Psr18ClientDiscovery.php:13 Stack trace: #0 /htdocs/emploitogo.info/wp-includes/php-ai-client/autoload.php(40): require() #1 [internal function]: {closure}('WordPress\\AiCli...') #2 /htdocs/emploitogo.info/wp-includes/php-ai-client/src/Providers/Http/Abstracts/AbstractClientDiscoveryStrategy.php(31): class_exists('WordPress\\AiCli...') #3 /htdocs/emploitogo.info/wp-settings.php(475): WordPress\AiClient\Providers\Http\Abstracts\AbstractClientDiscoveryStrategy::init() #4 /htdocs/emploitogo.info/wp-config.php(112): require_once('/htdocs/emploit...') #5 /htdocs/emploitogo.info/wp-load.php(50): require_once('/htdocs/emploit...') #6 /htdocs/emploitogo.info/wp-blog-header.php(13): require_once('/htdocs/emploit...') #7 /htdocs/emploitogo.info/index.php(17): require('/htdocs/emploit...') #8 {main} thrown in /htdocs/emploitogo.info/wp-includes/php-ai-client/third-party/Http/Discovery/Psr18ClientDiscovery.php on line 13