mensbeam/self-sealing-callable
最新稳定版本:v1.0.1
Composer 安装命令:
composer require mensbeam/self-sealing-callable
包简介
You won't find a better Self-Sealing Callable in this sector!
README 文档
README
You won't find a better Self-Sealing Callable in this sector!
Self-Sealing Callable is a class that implements __invoke() which can enable and disable itself. When registering shutdown functions in PHP it's not possible to unregister them. This class exists to be used in this case. By calling SelfSealingCallable->disable() it will return false when invoked, allowing retroactive disabling of the shutdown handler.
Requirements
- PHP 8.1
Installation
composer require mensbeam/self-sealing-callable
Usage
It's pretty simple:
use MensBeam\SelfSealingCallable; $callable = new SelfSealingCallable(fn() => 'ook'); $ook = $callable(); // 'ook' $callable->disable(); $ook = $callable(); // false $callable->enable(); $ook = $callable(); // 'ook'
统计信息
- 总下载量: 70
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-02-12