Comments (2)
记录下,目前简单的想法是在 on 方法中间添加一个参数用于可选的绑定,如分支的绑定。 在 on 执行时判断第三个参数是否为 Null ,如果不为 null 可认为第二个参数指定了这个可选的绑定,否则第二个参数就是 callable 的回调(之所以不去判断第二个参数是不是 string ,是因为 callable 也有可能是 string 的类型)
from coding-webhook-php.
如果需要扩展其它不同类型的其它参数,显然上面的方法已经不再适用。
另一种方法是修改保存回调的数组结构。在原来单纯的由回调构成的数组的基础上修改为包含回碉以及其它参数的结构。当指定类型的事件发生时,遍历所有结构体,并依次执行匹配所有条件的回调
from coding-webhook-php.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from coding-webhook-php.