bandwidth-throttle / token-bucket

Implementation of the Token Bucket algorithm in PHP.
Do What The F*ck You Want To Public License
503 stars 77 forks source link

Make TokenBucket extendable #13

Closed davyrolink closed 6 years ago

davyrolink commented 6 years ago
malkusch commented 6 years ago

Why do think it is a good idea to make that class extendable?

davyrolink commented 6 years ago

For a project I had different requirements for the consume method, so I wanted to extend the class and implement a custom consume method. But since the properties used in the consume method are private, it wasn't possible without making the properties protected.

malkusch commented 6 years ago

Could you please be more specific, what requirement made it necessary to extends TokenBucket?

Making this class extendable means increasing the public API. That's a big impact on maintainability. So you need to convince me in doing so. I obviously forgot to make those classes final. I'm sorry for causing confusion here. The next major release will fix that.