`return $this;` design pattern or anti-pattern?

前端 未结 5 1616
醉酒成梦
醉酒成梦 2021-01-17 13:22

I\'ve seen many times Zend Framework using return $this; pattern style - and from my point of view:

  • Pro: seems its quite not

5条回答
  •  情深已故
    2021-01-17 13:40

    This is called Fluent Interface, i don't think this is a pattern but better a way to implements function to reduce amount of code and improve readibility.

    I let you read the Wikipedia Page : http://en.wikipedia.org/wiki/Fluent_interface

提交回复
热议问题