mirror of
https://github.com/maxpozdeev/mytinytodo.git
synced 2026-03-11 08:55:27 +00:00
rename registeredExtensions()
This commit is contained in:
parent
8590f29e14
commit
fb33a74f69
2 changed files with 4 additions and 4 deletions
|
|
@ -61,7 +61,7 @@ $endpoints = array(
|
||||||
);
|
);
|
||||||
|
|
||||||
// look for extensions
|
// look for extensions
|
||||||
foreach (MTTExtensionLoader::registeredExtensions() as $instance) {
|
foreach (MTTExtensionLoader::loadedExtensions() as $instance) {
|
||||||
if ($instance instanceof MTTHttpApiExtender) {
|
if ($instance instanceof MTTHttpApiExtender) {
|
||||||
$newRoutes = $instance->extendHttpApi();
|
$newRoutes = $instance->extendHttpApi();
|
||||||
foreach ($newRoutes as $endpoint => $methods) {
|
foreach ($newRoutes as $endpoint => $methods) {
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@ class MTTExtensionLoader
|
||||||
throw new Exception("Failed to register extension '$ext': require class constants (codename, title)");
|
throw new Exception("Failed to register extension '$ext': require class constants (codename, title)");
|
||||||
}
|
}
|
||||||
if ($instance::codename != $ext) {
|
if ($instance::codename != $ext) {
|
||||||
throw new Exception("Extension '$ext' codename does not equal to extension dir");
|
throw new Exception("Extension '$ext' codename does not conforms to extension dir");
|
||||||
}
|
}
|
||||||
|
|
||||||
$instance->init();
|
$instance->init();
|
||||||
|
|
@ -134,7 +134,7 @@ class MTTExtensionLoader
|
||||||
/**
|
/**
|
||||||
* @return MTTExtension[]
|
* @return MTTExtension[]
|
||||||
*/
|
*/
|
||||||
public static function registeredExtensions(): array
|
public static function loadedExtensions(): array
|
||||||
{
|
{
|
||||||
$a = [];
|
$a = [];
|
||||||
foreach (self::$exts as $ext => $instance) {
|
foreach (self::$exts as $ext => $instance) {
|
||||||
|
|
@ -164,7 +164,7 @@ class MTTExtensionLoader
|
||||||
return self::$exts[$ext] ?? null;
|
return self::$exts[$ext] ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function isRegistered(string $ext): bool
|
public static function isLoaded(string $ext): bool
|
||||||
{
|
{
|
||||||
return isset(self::$exts[$ext]);
|
return isset(self::$exts[$ext]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue