PHP Class Devise\Pages\Interpreter\ViewOpener

"@include('some.path.here", ...) We will use Laravel's view path finder in order to transform the 'some.path.here' into a real file that we can open and inspect the html and thus fetch all devise tags from it.
Show file Open project: devisephp/cms Class Usage Examples

Protected Properties

Property Type Description
$finder Illuminate\View\FileViewFinder Search for view paths

Public Methods

Method Description
__construct ( Illuminate\View\FileViewFinder $finder = null, $file = null ) Construct a new view opener
findAllIncludedViews ( $viewPath, $ignore = [] ) : [type] Recursively finds every view that is included inside this view
open ( $includeStatement, &$includedViews ) : string Attempt to open the view path if something fails then we silently fail and return an empty string.
openViewPath ( [type] $path ) : [type] Find the real path

Protected Methods

Method Description
includeStatements ( string $content ) : array Gets the included views from all these matches
pathFromIncludeStatement ( $statement ) : null Finds the path from a $statement string. The pattern below searches for "@include('this.is.what.we.want', .

Method Details

__construct() public method

Construct a new view opener
public __construct ( Illuminate\View\FileViewFinder $finder = null, $file = null )
$finder Illuminate\View\FileViewFinder

findAllIncludedViews() public method

Recursively finds every view that is included inside this view
public findAllIncludedViews ( $viewPath, $ignore = [] ) : [type]
return [type]

includeStatements() protected method

Gets the included views from all these matches
protected includeStatements ( string $content ) : array
$content string
return array

open() public method

.. We have added the includedViews array so we do not attempt to open up those views (we don't need to because we've already found all the devise tags inside of those files since they've already been opened). If view#1 includes view#2 which includes view#1, this would have cause an infinite loop but b/c we keep up with which views have been included we know when to stop).
public open ( $includeStatement, &$includedViews ) : string
$includeStatement
$includedViews
return string

openViewPath() public method

Find the real path
public openViewPath ( [type] $path ) : [type]
$path [type]
return [type]

pathFromIncludeStatement() protected method

..)"
protected pathFromIncludeStatement ( $statement ) : null
$statement
return null

Property Details

$finder protected property

Search for view paths
protected Illuminate\View\FileViewFinder $finder
return Illuminate\View\FileViewFinder