protected function getExtension(IView $view) : string
    {
        // Find a registered extension that the view's path ends with
        foreach (array_keys($this->compilers) as $extension) {
            $lengthDifference = strlen($view->getPath()) - strlen($extension);

            if ($lengthDifference >= 0 && strpos($view->getPath(), $extension, $lengthDifference) !== false) {
                return $extension;
            }
        }

        throw new InvalidArgumentException("No extension registered for path \"{$view->getPath()}\"");
    }