public function __construct(Renderer $renderer, array $options = null) { parent::__construct($renderer, array_replace_recursive(['scheme' => 'jade-phtml'], $options ? $options : [])); if (!Wrapper::isRegistered($this->getOption('scheme'))) { Wrapper::register($this->getOption('scheme')); } }
public function __construct(Renderer $renderer, array $options = null) { parent::__construct($renderer, array_replace_recursive(['outputDirectory' => './cache/views', 'extension' => '.phtml', 'lifeTime' => 3600, 'directoryMode' => 0775, 'fileMode' => 0775], $options ? $options : [])); $dir = $this->getOption('outputDirectory'); if (!is_dir($dir)) { @mkdir($dir, $this->getOption('directoryMode'), true); if (!is_dir($dir)) { throw new \Exception("Failed to create output directory {$dir}"); } } if (!is_writable($dir)) { throw new \Exception("Output directory not writable {$dir}"); } }
/** * Creates a new File renderer adapter. * * If the cache directory doesn't exist, it tries to automatically create it * * Possible options are: * path: The path where rendered files are stored * extension: The extension we should store the files with (Default: .phtml) * lifeTime: The Cache lifeTime (Set to 0 to disable cache), (Default: 0) * * @param Renderer $renderer the renderer instance this renderer was created in * @param array|null $options the options array for this renderer adapter * * @throws \Exception when the Cache Directory is not writable */ public function __construct(Renderer $renderer, array $options = null) { parent::__construct($renderer, array_replace_recursive(['path' => './cache/views', 'extension' => '.phtml', 'lifeTime' => 0], $options ? $options : [])); $dir = $this->getOption('path'); //Automatically create directory if it doesn't exist (or try to do so) if (!is_dir($dir)) { @mkdir($dir, 0775, true); if (!is_dir($dir)) { throw new \Exception("Failed to create output directory {$dir}"); } } //Make sure we can write to it if (!is_writable($dir)) { throw new \Exception("Output directory not writable {$dir}"); } }
/** * Creates a new File renderer adapter. * * If the cache directory doesn't exist, it tries to automatically create it * * Possible options are: * path: The path where rendered files are stored * extension: The extension we should store the files with (Default: .phtml) * lifeTime: The Cache lifeTime (Set to 0 to disable cache), (Default: 0) * * @param Renderer $renderer the renderer instance this renderer was created in * @param array|null $options the options array for this renderer adapter * * @throws \Exception when the Cache Directory is not writable */ public function __construct(Renderer $renderer, array $options = null) { parent::__construct($renderer, $options); $this->setDefaults(['path' => './cache/views', 'extension' => '.phtml', 'ttl' => 0]); $dir = $this->getOption('path'); //Automatically create directory if it doesn't exist (or try to do so) if (!is_dir($dir)) { @mkdir($dir, 0775, true); if (!is_dir($dir)) { throw new RuntimeException("Failed to create output directory {$dir}"); } } //Make sure we can write to it if (!is_writable($dir)) { throw new RuntimeException("Output directory {$dir} not writable"); } }
/** * Creates a new stream adapter. * * Possible options are: * scheme: The scheme to register the wrapper as (default: 'jade-phtml') * * If the stream wrapper with the given name is not registered yet, * it is registered * The stream wrapper used is \Tale\Jade\Renderer\Adapter\Stream\Wrapper * * @param Renderer $renderer the renderer instance this adapter was created in * @param array|null $options an array of options for the adapter */ public function __construct(Renderer $renderer, array $options = null) { parent::__construct($renderer, $options); $this->setDefaults(['scheme' => 'jade-phtml']); if (!Wrapper::isRegistered($this->getOption('scheme'))) { Wrapper::register($this->getOption('scheme')); } }