Skip to content

Latest commit

 

History

History
42 lines (33 loc) · 838 Bytes

File metadata and controls

42 lines (33 loc) · 838 Bytes

Contexts

Build Status codecov

a PHP library that emulates Python's with statement

Example

<?php
use function Contexts\with;
use Contexts\Context;

class TestContext implements Context
{
  public function enter()
  {
    print("Before executing function\n");
  }

  public function quit($exception)
  {
    print("After executing function\n");
  }
}

$context = new TestContext;
with($context, function() {
  print("Executing function\n");
});

?>

Testing

phpunit tests

Credits