Re: Feature request and RFC
| From: | Alexander Lisachenko | Date: | Wed, 25 Feb 2015 11:15:30 +0000 |
| Subject: | Re: Feature request and RFC | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-83765@lists.php.net to get a copy of this message | ||
2015-02-25 13:37 GMT+03:00 Thomas Gielfeldt <thomas@gielfeldt.dk>:
> Yeah, but the "problem" with this, is that your class' sort method, you
> have to implement all the possible permutations the flags can produce. This
> basically just squeezes the 11 functions into 1. The 1 interface with
> sort() and usort() splits this into 2 functions (8+3). With that in mind,
> I'm more inclined to choose the 4 interface approach.
For that case, move all configurations to the several classes and configure
these flags in the concrete constructors. Interface will be more simple:
interface Sortable {
const ASC = 1;
const DESC = 2;
public function sort($direction = self::ASC, callable $callback = null);
}
class KeySorter implements Sortable {}