diff --git a/src/Compiler.php b/src/Compiler.php index 3edb082..f59b19a 100644 --- a/src/Compiler.php +++ b/src/Compiler.php @@ -158,6 +158,19 @@ class Compiler 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(<<