public static function loaded($plugin = null)
    {
        if ($plugin !== null) {
            deprecationWarning(
                'Checking a single plugin with Plugin::loaded() is deprecated. ' .
                'Use Plugin::isLoaded() instead.'
            );

            return static::getCollection()->has($plugin);
        }
        $names = [];
        foreach (static::getCollection() as $plugin) {
            $names[] = $plugin->getName();
        }
        sort($names);

        return $names;
    }