public function registerEngine($engineClass, $engineName, $engineFileExtensions = array()): bool
    {
        // First check if the engine already exists
        if (isset($this->engines[$engineName])) {
            throw new LayoutException("Could not register engine. Engine '".$engineName."' already registered", 1);
        }

        // Then check if the object is correct
        if ($engineClass instanceof TemplateEngine) {
            // Install it
            $this->engines[$engineName] = $engineClass;

            // Then define for what file extensions this Template Engine will work
            if (!is_array($engineFileExtensions)) {
                throw new LayoutException('Could not register engine. File extensions must be an array', 1);
            }

            // Then install them
            foreach ($engineFileExtensions as $extension) {
                if (isset($this->file_extensions[strtolower($extension)])) {
                    throw new LayoutException('Could not register engine. File extension already bound to engine', 1);
                }

                // And add it
                $this->file_extensions[strtolower($extension)] = $engineName;
            }

            // And log it
            Logger::log('Registered Template Engine: '.$engineName);

            return true;
        }

        throw new LayoutException("Could not register engine. Engine must implement \FuzeWorks\TemplateEngine", 1);
    }
public function registerEngine($engineClass, $engineName, $engineFileExtensions = array()): bool
    {
        // First check if the engine already exists
        if (isset($this->engines[$engineName])) {
            throw new LayoutException("Could not register engine. Engine '".$engineName."' already registered", 1);
        }

        // Then check if the object is correct
        if ($engineClass instanceof TemplateEngine) {
            // Install it
            $this->engines[$engineName] = $engineClass;

            // Then define for what file extensions this Template Engine will work
            if (!is_array($engineFileExtensions)) {
                throw new LayoutException('Could not register engine. File extensions must be an array', 1);
            }

            // Then install them
            foreach ($engineFileExtensions as $extension) {
                if (isset($this->file_extensions[strtolower($extension)])) {
                    throw new LayoutException('Could not register engine. File extension already bound to engine', 1);
                }

                // And add it
                $this->file_extensions[strtolower($extension)] = $engineName;
            }

            // And log it
            Logger::log('Registered Template Engine: '.$engineName);

            return true;
        }

        throw new LayoutException("Could not register engine. Engine must implement \FuzeWorks\TemplateEngine", 1);
    }
public function registerEngine ( $ engineClass , $ engineName , $ engineFileExtensions = array ( ) ) : bool { // First check if the engine already exists if ( isset ( $ this -> engines [ $ engineName ] ) ) { throw new LayoutException ( "Could not register engine. Engine '" . $ engineName . "' already registered" , 1 ) ; } // Then check if the object is correct if ( $ engineClass instanceof TemplateEngine ) { // Install it $ this -> engines [ $ engineName ] = $ engineClass ; // Then define for what file extensions this Template Engine will work if ( ! is_array ( $ engineFileExtensions ) ) { throw new LayoutException ( 'Could not register engine. File extensions must be an array' , 1 ) ; } // Then install them foreach ( $ engineFileExtensions as $ extension ) { if ( isset ( $ this -> file_extensions [ strtolower ( $ extension ) ] ) ) { throw new LayoutException ( 'Could not register engine. File extension already bound to engine' , 1 ) ; } // And add it $ this -> file_extensions [ strtolower ( $ extension ) ] = $ engineName ; } // And log it Logger :: log ( 'Registered Template Engine: ' . $ engineName ) ; return true ; } throw new LayoutException ( "Could not register engine. Engine must implement \FuzeWorks\TemplateEngine" , 1 ) ; }
Register a new template engine.

@param object $engineClass          Object that implements the \FuzeWorks\TemplateEngine
@param string $engineName           Name of the template engine
@param array  $engineFileExtensions File extensions this template engine should be used for

@return bool true on success
@throws LayoutException
Register a new template engine .