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
        );
    }