Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
43 lines (28 sloc) 584 Bytes

Guard

Simplly cleaning up resources with RAII pattern.

Synopsis

unset()

$guard = new Guard(function () { echo "unset!\n"; });
unset($guard); //=> unset!

Function Scope

function foo()
{
    $guard = new Guard(function () { echo "destructed!\n"; });
    // ... do something ...
}

foo(); //=> echoed "destructed!" after function called

Run Tests Using Composer

$ curl -s https://getcomposer.org/installer | php
$ php composer.phar install
$ bin/phpunit

LICENSE

Copyright

Copyright Kentaro Kuribayashi

LICENSE

MIT LICENSE