Re: static/object method

From: Date: Thu, 24 Jun 2004 11:13:28 +0000
Subject: Re: static/object method
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-10752@lists.php.net to get a copy of this message
Taco Van Den Broek wrote:
Hans Lellelid wrote:
static, default behavior, probably accounts for 80% of uses: $c = new Criteria(Author::NAME, "Leo"); $a = AuthorFinder::find($c);
You pass your criteria to your search class as instantiated objects, why don't you pass your parameters/config flags as another type of object? Maybe like this: $c = new Criteria(Author::NAME, "Leo"); $f = new ConfigFlag(AuthorFinder::LIMIT, '5'); $a = AuthorFinder::find($c, $f); You could then check the $f object for any customizations, just like you check the $c object for where to search.
That's a good suggestion -- probably the cleanest design possible in current PHP object model. Thanks, Hans

« previous php.internals (#10752) next »