phug / invoker
基于类型推断的调用器
资助包维护!
kylekatarnls
Open Collective
Tidelift
Requires
- php: >=5.5.0
- phug/event: ^1.4
Requires (Dev)
- phug/compiler: ^1.4
- phug/parser: ^1.4
- dev-master / 1.x-dev
- 1.13.0
- 1.12.3
- 1.12.2
- 1.12.1
- 1.12.0
- 1.11.0
- 1.10.0
- 1.9.0
- 1.8.3
- 1.8.2
- 1.8.1
- 1.8.0
- 1.7.3
- 1.7.2
- 1.7.1
- 1.7.0
- 1.6.0
- 1.5.0
- dev-remotes/pull/106/merge
- dev-remotes/pull/107/merge
- dev-remotes/pull/108/merge
- dev-remotes/pull/109/merge
- dev-remotes/pull/105/merge
- dev-fix/strict-in-array
- dev-remotes/pull/104/merge
- dev-feature/abstract-token-handler
- dev-feature/duplication-threshold
- dev-remotes/pull/100/merge
- dev-remotes/pull/101/merge
- dev-remotes/pull/102/merge
- dev-remotes/pull/98/merge
- dev-remotes/pull/99/merge
- dev-simplify-split-script
- dev-feature/check-php-8
- dev-feature/issue-69-interpolations-in-comments
- dev-feature/issue-70-disallow-new-line-in-interpolations
- dev-feature/php-8-namespace
- dev-multitest-php-8
This package is auto-updated.
Last update: 2024-09-19 15:58:07 UTC
README
什么是Phug Invoker?
通过类类型注册回调,并调用调用器以执行与给定对象匹配的回调。
安装
通过Composer安装
composer require phug/invoker
使用方法
class Foo {} class Bar {} $invoker = new \Phug\Invoker([ function (Foo $foo) { return 'foo'; }, function (Bar $bar) { return 'BAR'; }, ]); $invoker->invoke(new Foo); // ['foo'] $invoker->invoke(new Bar); // ['BAR']