ViewFactory
class ViewFactory
View factory.
Traits
Properties
| protected string | $path | Path. | |
| protected string | $extension | File extension. | from NamespacedFileLoaderTrait | 
| protected array | $namespaces | Namespaces. | from NamespacedFileLoaderTrait | 
| protected FileSystem | $fileSystem | File sytem. | |
| protected string | $charset | Charset. | |
| protected Container | $container | Container. | |
| protected array | $renderers | View renderers. | |
| protected array | $globalVariables | Global view variables. | |
| protected array | $autoAssignVariables | Variables that should be auto assigned to views. | |
| protected array | $viewCache | View cache. | |
| protected array | $rendererInstances | Renderer instances. | 
Methods
Registers a namespace.
Returns the path to the file.
Returns an array of cascading file paths.
Constructor.
Returns the charset.
Sets the charset.
Assign a global view variable that will be available in all views.
Assign variables that should be auto assigned to views upon creation.
Clears the autoassign variables.
Returns an array containing the view path and the renderer we should use.
Returns a renderer instance.
Returns TRUE if the view exists and FALSE if not.
Returns view specific auto assign variables.
Returns auto assign variables for a view.
Returns array where variables have been merged in order of importance.
Creates and returns a rendered view.
Details
        in NamespacedFileLoaderTrait at         line 51
                            
    setPath(string $path)
        
    
    Sets the default path.
        in NamespacedFileLoaderTrait at         line 61
                            
    setExtension(string $extension)
        
    
    Sets the extension.
        in NamespacedFileLoaderTrait at         line 72
                            
    registerNamespace(string $namespace, string $path)
        
    
    Registers a namespace.
        in NamespacedFileLoaderTrait at         line 85
                    protected        string
    getFilePath(string $file, string|null $extension = null, string|null $suffix = null)
        
    
    Returns the path to the file.
        in NamespacedFileLoaderTrait at         line 127
                    protected        array
    getCascadingFilePaths(string $file, string|null $extension = null, string|null $suffix = null)
        
    
    Returns an array of cascading file paths.
        at         line 99
                            
    __construct(FileSystem $fileSystem, string $path, string $charset = 'UTF-8', Container|null $container = null)
        
    
    Constructor.
        at         line 117
                            string
    getCharset()
        
    
    Returns the charset.
        at         line 128
                            ViewFactory
    setCharset(string $charset)
        
    
    Sets the charset.
        at         line 142
                            ViewFactory
    extend(string $extension, string|Closure $renderer)
        
    
    Registers a custom view renderer.
        at         line 156
                            ViewFactory
    assign(string $name, mixed $value)
        
    
    Assign a global view variable that will be available in all views.
        at         line 170
                            ViewFactory
    autoAssign(string $view, callable $variables)
        
    
    Assign variables that should be auto assigned to views upon creation.
        at         line 185
                            ViewFactory
    clearAutoAssignVariables()
        
    
    Clears the autoassign variables.
        at         line 199
                    protected        array|false
    getViewPathAndExtension(string $view, bool $throwException = true)
        
    
    Returns an array containing the view path and the renderer we should use.
        at         line 237
                    protected        RendererInterface
    rendererFactory(string|Closure $renderer)
        
    
    Creates a renderer instance.
        at         line 248
                    protected        RendererInterface
    resolveRenderer(string $extension)
        
    
    Returns a renderer instance.
        at         line 264
                            bool
    exists(string $view)
        
    
    Returns TRUE if the view exists and FALSE if not.
        at         line 275
                    protected        array
    getAutoAssignVariablesForView(string $view)
        
    
    Returns view specific auto assign variables.
        at         line 291
                    protected        array
    getAutoAssignVariables(string $view)
        
    
    Returns auto assign variables for a view.
        at         line 303
                    protected        array
    mergeVariables(string $view, array $variables)
        
    
    Returns array where variables have been merged in order of importance.
        at         line 315
                            View
    create(string $view, array $variables = [])
        
    
    Creates and returns a view instance.
        at         line 329
                            string
    render(string $view, array $variables = [])
        
    
    Creates and returns a rendered view.