1 Commits
Author SHA1 Message Date
Dave Mc Nicoll 2931a462c0 - Added a new getExtensionInstanceOf() method in Compiler 2026-10-22 15:15:38 +00:00
+13
View File
@@ -158,6 +158,19 @@ class Compiler
return $this->extensionList[$tokenName]; return $this->extensionList[$tokenName];
} }
public function getExtensionInstanceOf(string $class) : Extension\Extension
{
foreach(array_reverse($this->extensionList) as $ext) {
if ( is_a($ext, $class, false) ) {
return $ext;
}
}
throw new \InvalidArgumentException(<<<MSG
Requested extension instance of `$class` could not be found from loaded Picea compiler's extension.
MSG);
}
public function exportFunctions() : void public function exportFunctions() : void
{ {
static $caching = []; static $caching = [];