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
Example #1
0
 public function testResetSharedVariables()
 {
     $jade = new Jade();
     $jade->share('answear', 42);
     $jade->share(array('foo' => 'Hello', 'bar' => 'world'));
     $jade->resetSharedVariables();
     $error = null;
     try {
         $jade->render("p\n  =foo\n=' '\n=bar\n  | !");
     } catch (\Exception $e) {
         $error = $e->getMessage();
     }
     $this->assertSame('Undefined variable: foo', $error);
 }