PHP Class Jade\Jade

Inheritance: extends Jade\Engine\Keywords
Show file Open project: kylekatarnls/jade-php Class Usage Examples

Protected Properties

Property Type Description
$filters array Built-in filters.
$sharedVariables array
$streamName string

Public Methods

Method Description
__construct ( array $options = [] ) Merge local options with constructor $options.
compile ( string $input, string $filename = null ) : string Compile PHP code from a Pug input or a Pug file.
render ( $input, $filename = null, array $vars = [] ) : string Compile HTML code from a Pug input or a Pug file.
requirements ( $name = null ) : array | boolean Returns list of requirements in an array identified by keys.
resetSharedVariables ( ) Remove all previously set shared variables.
share ( $variables, mixed $value = null ) Add a variable or an array of variables to be shared with all templates that will be rendered by the instance of Pug.
stream ( $input ) : string Create a stream wrapper to allow the possibility to add $scope variables.

Protected Methods

Method Description
whiteListNeeded ( $extension ) : boolean Returns true if suhosin extension is loaded and the stream name is missing in the executor include whitelist.

Method Details

__construct() public method

Merge local options with constructor $options.
public __construct ( array $options = [] )
$options array

compile() public method

Compile PHP code from a Pug input or a Pug file.
public compile ( string $input, string $filename = null ) : string
$input string input file (or input content if filenname is specified or no file found)
$filename string filename for the input code
return string

render() public method

Compile HTML code from a Pug input or a Pug file.
public render ( $input, $filename = null, array $vars = [] ) : string
$vars array
return string

requirements() public method

For each of them, the value can be true if the requirement is fullfilled, false else. If a requirement name is specified, returns only the matching boolean value for this requirement.
public requirements ( $name = null ) : array | boolean
return array | boolean

resetSharedVariables() public method

Remove all previously set shared variables.

share() public method

Add a variable or an array of variables to be shared with all templates that will be rendered by the instance of Pug.
public share ( $variables, mixed $value = null )
$value mixed if you pass an array as first argument, the second argument will be ignored, else it will used as the variable value for the variable name you passed as first argument

stream() public method

Create a stream wrapper to allow the possibility to add $scope variables.
public stream ( $input ) : string
return string

whiteListNeeded() protected method

Returns false in any other case.
protected whiteListNeeded ( $extension ) : boolean
return boolean

Property Details

$filters protected property

Built-in filters.
protected array $filters
return array

$sharedVariables protected property

protected array $sharedVariables
return array

$streamName protected property

protected string $streamName
return string