CommonClassesStrategy::getPsr18Candidates(): array

In this article

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only by core. It is listed here for completeness.

Return

array The return value is always an array with zero or more elements. Each element is an array with two keys ['class' => string, 'condition' => mixed].

Source

private static function getPsr18Candidates()
{
    $candidates = self::$classes[Psr18Client::class];
    // HTTPlug 2.0 clients implements PSR18Client too.
    foreach (self::$classes[HttpClient::class] as $c) {
        if (!is_string($c['class'])) {
            continue;
        }
        try {
            if (ClassDiscovery::safeClassExists($c['class']) && is_subclass_of($c['class'], Psr18Client::class)) {
                $candidates[] = $c;
            }
        } catch (\Throwable $e) {
            trigger_error(sprintf('Got exception "%s (%s)" while checking if a PSR-18 Client is available', get_class($e), $e->getMessage()), \E_USER_WARNING);
        }
    }
    return $candidates;
}

User Contributed Notes

You must log in before being able to contribute a note or feedback.