2015-02-24 17:36 GMT+01:00 Benjamin Eberlei <kont...@beberlei.de>: > Hi, > > On Tue, Feb 24, 2015 at 5:17 PM, Thomas Gielfeldt <tho...@gielfeldt.dk> > wrote: > >> Hi internals. >> >> I've made PR proposing a feature request: A new interface Sortable. >> >> https://github.com/php/php-src/pull/1116 >> >> If possible, I would like to create and RFC describing this in more >> detail, >> and perhaps get a voting on. >> > > so you need to implement all methods? This can probably be considered a > violation of the Interface Segregation Principle. But adding an interface > for each method seems a bit much as well. >
Yeah, I've thought of this as well. PHP has got a load of sort functions. I've also considered other options: 1.) 5 interfaces for, respectively, (r)sort, a(r)sort, k(r)sort, u(a|k)sort and nat(case)sort, with 2-3 methods per interface. 2.) Same as above, but with a flag for reverse instead of a dedicated function resulting in 5 interfaces with 1-3 methods each. 3.) 1 interface with 2 methods, sort() and usort(), and flags for reverse, key and maintaining index. I did consider the latter much, but wasn't sure if the methods would get too monolithic. I also did consider an interface per method. Briefly. :-) > >> Thanks >> >> Br, >> >> Thomas Gielfeldt >> > >