public function addResource($name, $class, $compilerFactory = null)
    {
        if (strlen($name) < 2) {
            throw new Exception('Resource names must be at least two-character long to avoid conflicts with Windows paths');
        }

        if (!class_exists($class)) {
            throw new Exception(sprintf('Resource class %s does not exist', $class));
        }

        $interfaces = class_implements($class);
        if (in_array('Dwoo\ITemplate', $interfaces) === false) {
            throw new Exception('Resource class must implement ITemplate');
        }

        $this->resources[$name] = array(
            'class'    => $class,
            'compiler' => $compilerFactory
        );
    }
public function addResource($name, $class, $compilerFactory = null)
    {
        if (strlen($name) < 2) {
            throw new Exception('Resource names must be at least two-character long to avoid conflicts with Windows paths');
        }

        if (!class_exists($class)) {
            throw new Exception(sprintf('Resource class %s does not exist', $class));
        }

        $interfaces = class_implements($class);
        if (in_array('Dwoo\ITemplate', $interfaces) === false) {
            throw new Exception('Resource class must implement ITemplate');
        }

        $this->resources[$name] = array(
            'class'    => $class,
            'compiler' => $compilerFactory
        );
    }
public function addResource ( $ name , $ class , $ compilerFactory = null ) { if ( strlen ( $ name ) < 2 ) { throw new Exception ( 'Resource names must be at least two-character long to avoid conflicts with Windows paths' ) ; } if ( ! class_exists ( $ class ) ) { throw new Exception ( sprintf ( 'Resource class %s does not exist' , $ class ) ) ; } $ interfaces = class_implements ( $ class ) ; if ( in_array ( 'Dwoo\ITemplate' , $ interfaces ) === false ) { throw new Exception ( 'Resource class must implement ITemplate' ) ; } $ this -> resources [ $ name ] = array ( 'class' => $ class , 'compiler' => $ compilerFactory ) ; }
Adds a resource or overrides a default one.

@param string   $name            the resource name
@param string   $class           the resource class (which must implement ITemplate)
@param callback $compilerFactory the compiler factory callback, a function that must return a compiler instance
used to compile this resource, if none is provided. by default it will produce
a Compiler object

@return void
@throws Exception
Adds a resource or overrides a default one .