$replaceFunction
$replaceFunction : callable
Renderer using files system.
Options to customize paths:
__construct(\Phug\Renderer $renderer, array|\ArrayObject $options)
AbstractAdapter constructor.
\Phug\Renderer | $renderer | current renderer used. |
array|\ArrayObject | $options | options array/object to be propagated from renderer to the adapter. |
getRenderer() : \Phug\Renderer
Get the current linked renderer.
cache(string $path, string $input, callable $rendered, \Phug\Renderer\Adapter\&bool $success = null) : string
Return the cached file path after cache optional process.
string | $path | pug file |
string | $input | pug input code |
callable | $rendered | method to compile the source into PHP |
\Phug\Renderer\Adapter\&bool | $success | reference to a variable to be set to true/false on success/failure |
displayCached(string $path, string $input, callable $rendered, array $variables, \Phug\Renderer\Adapter\&bool $success = null)
Display rendered template after optional cache process.
string | $path | pug file |
string | $input | pug input code |
callable | $rendered | method to compile the source into PHP |
array | $variables | local variables |
\Phug\Renderer\Adapter\&bool | $success | reference to a variable to be set to true/false on success/failure |
cacheFileIfChanged(string $path) : boolean|integer
Cache a template file in the cache directory if the cache is obsolete.
Returns true if the cache is up to date and cache not change, else returns the number of bytes written in the cache file or false if a failure occurred.
string | $path |
cacheDirectory(array<mixed,string>|string $directory) : array
Scan a directory recursively for its views, compile them and save them into the cache directory.
array<mixed,string>|string | $directory | the directory to search pug files in it. |
count of cached files and error count
locate(string $path, array $locations, array $extensions) : string
Translates a given path by searching it in the passed locations and with the passed extensions.
string | $path | the file path to translate. |
array | $locations | the directories to search in. |
array | $extensions | the file extensions to search for (e.g. ['.jd', '.pug']. |
reInitCompiler(\Phug\Renderer $renderer, array $events) : \Phug\CompilerInterface
\Phug\Renderer | $renderer | |
array | $events |
compileAndCache(\Phug\CompilerInterface $compiler, string $path, string $inputFile) : boolean
Compile a file with a given compiler and cache it.
\Phug\CompilerInterface | $compiler | |
string | $path | |
string | $inputFile |
normalizePath(\Phug\CompilerInterface $compiler, string $path, string $directory) : string
Compile a file with a given compiler and cache it.
\Phug\CompilerInterface | $compiler | |
string | $path | |
string | $directory |
findCachePathInRegistry(string $path, array $registry, array<mixed,string> $extensions = array()) : string|false
Find the path of a cached file for a given path in a given registry.
string | $path | path to find in the registry |
array | $registry | registry data array |
array<mixed,string> | $extensions | extensions to try to add to the file path if not found |
findCachePathInRegistryFile(string $path, string $registryFile, array<mixed,string> $extensions = array()) : string|false
Find the path of a cached file for a given path in a given registry file (that may not exist).
string | $path | path to find in the registry |
string | $registryFile | registry file path |
array<mixed,string> | $extensions | extensions to try to add to the file path if not found |
execute(\Closure $execution, array $variables)
Bind context ($this) to a given closure if passed in local variables, and bind the current adapter as __pug_adapter variable.
\Closure | $execution | Function to be executed to render/display the rendered template. |
array | $variables | Render local variables. |
tryExtensionsOnFileKey(array $registry, string $key, array<mixed,string> $extensions) : boolean|mixed
Try to append extension to find a key in a given array if it's file registry key.
array | $registry | |
string | $key | |
array<mixed,string> | $extensions |
findInRegistry(string $path, array $registry, array<mixed,string> $extensions) : string|array|false
Find raw entry of a cached file for a given path in a given registry.
string | $path | path to find in the registry |
array | $registry | registry data array |
array<mixed,string> | $extensions | extensions to try to add to the file path if not found |
getRegistryPath(string $path, array<mixed,string> $extensions = array()) : string|false
Get path from the cache registry (if up_to_date_check set to false only).
string | $path | required view path. |
array<mixed,string> | $extensions | optional list of extensions to try. |
false if no path registered, the path else.