Upgrade to 3.7.0
This commit is contained in:
0
kirby/src/Filesystem/Asset.php
Normal file → Executable file
0
kirby/src/Filesystem/Asset.php
Normal file → Executable file
0
kirby/src/Filesystem/Dir.php
Normal file → Executable file
0
kirby/src/Filesystem/Dir.php
Normal file → Executable file
28
kirby/src/Filesystem/F.php
Normal file → Executable file
28
kirby/src/Filesystem/F.php
Normal file → Executable file
@@ -393,6 +393,34 @@ class F
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* A super simple class autoloader
|
||||
* @since 3.7.0
|
||||
*
|
||||
* @param array $classmap
|
||||
* @param string|null $base
|
||||
* @return void
|
||||
*/
|
||||
public static function loadClasses(array $classmap, ?string $base = null): void
|
||||
{
|
||||
// convert all classnames to lowercase
|
||||
$classmap = array_change_key_case($classmap);
|
||||
|
||||
spl_autoload_register(function ($class) use ($classmap, $base) {
|
||||
$class = strtolower($class);
|
||||
|
||||
if (!isset($classmap[$class])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($base) {
|
||||
include $base . '/' . $classmap[$class];
|
||||
} else {
|
||||
include $classmap[$class];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads a file with as little as possible in the variable scope
|
||||
*
|
||||
|
0
kirby/src/Filesystem/File.php
Normal file → Executable file
0
kirby/src/Filesystem/File.php
Normal file → Executable file
0
kirby/src/Filesystem/Filename.php
Normal file → Executable file
0
kirby/src/Filesystem/Filename.php
Normal file → Executable file
0
kirby/src/Filesystem/IsFile.php
Normal file → Executable file
0
kirby/src/Filesystem/IsFile.php
Normal file → Executable file
0
kirby/src/Filesystem/Mime.php
Normal file → Executable file
0
kirby/src/Filesystem/Mime.php
Normal file → Executable file
Reference in New Issue
Block a user