Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83768 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 5155 invoked from network); 25 Feb 2015 11:42:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Feb 2015 11:42:41 -0000 Authentication-Results: pb1.pair.com smtp.mail=thomas@gielfeldt.dk; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=thomas@gielfeldt.dk; sender-id=unknown Received-SPF: error (pb1.pair.com: domain gielfeldt.dk from 209.85.215.46 cause and error) X-PHP-List-Original-Sender: thomas@gielfeldt.dk X-Host-Fingerprint: 209.85.215.46 mail-la0-f46.google.com Received: from [209.85.215.46] ([209.85.215.46:43092] helo=mail-la0-f46.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 63/88-62407-F25BDE45 for ; Wed, 25 Feb 2015 06:42:40 -0500 Received: by labhv19 with SMTP id hv19so3187602lab.10 for ; Wed, 25 Feb 2015 03:42:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=y0ogcOH9ae5usPJdWN2tmHzN79UHTtJQpSzmi1tTfm0=; b=Wnsdj/I/atnLRV93ZMxLyUXKYCCcfjCsHS58B4uAUpv1tsrZrJ3ysLRldU9K3GHyUg GQ7qqjuyYzU8Uz4O+NsD+NWaTUrtxYTX4rY7wDIc3xvZTbdOoRG2E4WsjUizNS8NemIN pCzBkkQXZAK/YnfIM19TjgUFOwpfOa71Y4dJ1FlS+9Ae7Ax8N9KcqT1PpBZk6AmdJyWE 8NohLSg+VNVq2kwTh6bqs9l9lTcYKZoDQ249m0J1Q1R8sRF4vr1lD3d4E+2DPv6iBNoU H8X9wOxwi/lb06/eCeez73NduXyGAO9hFmMrOL1TULTmjqs7+5yArIFHa1N4VSzxyC0f Mozg== X-Gm-Message-State: ALoCoQlH4pD6DkmEO+MY4I6Z4V8yH4J0ujsoWR17YGE4lT180omPm5WYbu1r+rHPk62COZwlgrc6 X-Received: by 10.112.154.199 with SMTP id vq7mr2226884lbb.99.1424864556075; Wed, 25 Feb 2015 03:42:36 -0800 (PST) MIME-Version: 1.0 Received: by 10.152.144.194 with HTTP; Wed, 25 Feb 2015 03:42:15 -0800 (PST) In-Reply-To: References: Date: Wed, 25 Feb 2015 12:42:15 +0100 Message-ID: To: Alexander Lisachenko Cc: Benjamin Eberlei , PHP Internals Content-Type: multipart/alternative; boundary=089e0112d03cb860f2050fe821c7 Subject: Re: [PHP-DEV] Feature request and RFC From: thomas@gielfeldt.dk (Thomas Gielfeldt) --089e0112d03cb860f2050fe821c7 Content-Type: text/plain; charset=UTF-8 2015-02-25 12:15 GMT+01:00 Alexander Lisachenko : > > 2015-02-25 13:37 GMT+03:00 Thomas Gielfeldt : > >> 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 {} > That seems a little backwards to me? How would the consumer of e.g. KeySorter know which sort variations are implemented? --089e0112d03cb860f2050fe821c7--