Habari\Plugins::class_from_filename PHP Метод

class_from_filename() публичный статический Метод

function class_from_filename returns the class name from a plugin's filename
public static class_from_filename ( string $file, boolean $check_realpath = false ) : string
$file string the full path to a plugin file
$check_realpath boolean whether or not to try realpath resolution
Результат string the class name
    public static function class_from_filename($file, $check_realpath = false)
    {
        if ($check_realpath) {
            $file = realpath($file);
        }
        foreach (self::get_plugin_classes() as $plugin) {
            $class = new \ReflectionClass($plugin);
            $classfile = str_replace('\\', '/', $class->getFileName());
            if ($classfile == $file) {
                return $plugin;
            }
        }
        // if we haven't found the plugin class, try again with realpath resolution:
        if ($check_realpath) {
            // really can't find it
            return false;
        } else {
            return self::class_from_filename($file, true);
        }
    }