Grima  2018-08
Whispering into Alma's ear
Public Member Functions | Protected Attributes | List of all members
zemowsplat\SplatExecutionContext Class Reference

Helper class for Splat that runs the template PHP. More...

Public Member Functions

 __construct ( $file, array $scope)
 Record the $file and $scope More...
 
 splat ()
 extract the scope and include the file More...
 

Protected Attributes

 $file
 
 $scope
 

Detailed Description

Helper class for Splat that runs the template PHP.

In order to keep the variable scope for the template clean, we have a very simple class that keeps track of what file to execute in what scope. It sets up the scope, and includes the file.

Definition at line 156 of file grima-splats.php.

Constructor & Destructor Documentation

◆ __construct()

zemowsplat\SplatExecutionContext::__construct (   $file,
array  $scope 
)

Record the $file and $scope

Parameters
string$file- The PHP file to execute via include
array$scope- The associative array to use as the scope via extract

Definition at line 164 of file grima-splats.php.

164  {
165  $this->file = $file;
166  $this->scope = $scope;
167  }

Member Function Documentation

◆ splat()

zemowsplat\SplatExecutionContext::splat ( )

extract the scope and include the file

Definition at line 172 of file grima-splats.php.

172  {
173  extract($this->scope);
174  include $this->file;
175  }

Member Data Documentation

◆ $file

zemowsplat\SplatExecutionContext::$file
protected

Definition at line 157 of file grima-splats.php.

◆ $scope

zemowsplat\SplatExecutionContext::$scope
protected

Definition at line 158 of file grima-splats.php.


The documentation for this class was generated from the following file: