Pipe\SafetyColons::render PHP Method

render() public method

public render ( $context = null, $locals = [] )
    function render($context = null, $locals = array())
    {
        # Leave the contents alone, if the data is either empty or
        # already contains a semicolon at the end.
        if (preg_match('/\\A\\s*\\Z/m', $this->data) or preg_match('/;\\s*\\Z/m', $this->data)) {
            return $this->data;
        } else {
            return "{$this->data};";
        }
    }

Usage Example

Example #1
0
 /**
  * @dataProvider dataProvider
  */
 function test($message, $expected, $data)
 {
     $templ = new SafetyColons(function () use($data) {
         return $data;
     });
     $this->assertEquals($expected, $templ->render(), $message);
 }
SafetyColons