Re:A DSL in 5 Languages: Ruby, Python, PHP, C#, Java
by Nycto on Tuesday August 03, 2010 @05:55PM
(#1572898)
For the PHP version: Why is the search method static? You are forcing whatever class you are using to be tightly coupled. Dependency injection can be done in PHP, too.
Also, please make sure the search method returns an iterator, not an array. Just because PHP allows you to shoot yourself in the foot, doesn't mean you should.
Better:
If you're really up to it, there is no reason you couldn't use an even more fluent interface in PHP... Also, please make sure the search method returns an iterator, not an array. Just because PHP allows you to shoot yourself in the foot, doesn't mean you should.