diff --git a/examples/signaltraps.php b/examples/signaltraps.php index 56c6567..7928900 100644 --- a/examples/signaltraps.php +++ b/examples/signaltraps.php @@ -9,8 +9,15 @@ use NoccyLabs\Ipc\Signal\SignalTrap; $trap = new SignalTrap(SIGINT); echo "Press ctrl-c...\n"; -while (!$trap->isTrapped()) { +while (!$trap->isTrapped(true)) { usleep(10000); } -echo "Thanks!\n"; \ No newline at end of file +echo "Thanks!\n"; +echo "And once more...\n"; + +while (!$trap(true)) { + usleep(10000); +} + +echo "Thanks!\n"; diff --git a/phpunit.xml b/phpunit.xml index f3b710c..adac9fe 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -8,7 +8,7 @@ beStrictAboutTestsThatDoNotTestAnything="true" beStrictAboutTodoAnnotatedTests="true" verbose="true"> - + tests diff --git a/src/Signal/SignalTrap.php b/src/Signal/SignalTrap.php index ecac4ec..8932c9e 100644 --- a/src/Signal/SignalTrap.php +++ b/src/Signal/SignalTrap.php @@ -45,4 +45,9 @@ class SignalTrap return false; } -} \ No newline at end of file + public function __invoke($reset=true):bool + { + return $this->isTrapped($reset); + } + +}