Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83765 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 99506 invoked from network); 25 Feb 2015 11:15:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Feb 2015 11:15:34 -0000 Authentication-Results: pb1.pair.com smtp.mail=lisachenko.it@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=lisachenko.it@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.176 as permitted sender) X-PHP-List-Original-Sender: lisachenko.it@gmail.com X-Host-Fingerprint: 74.125.82.176 mail-we0-f176.google.com Received: from [74.125.82.176] ([74.125.82.176:39231] helo=mail-we0-f176.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 94/77-62407-4DEADE45 for ; Wed, 25 Feb 2015 06:15:33 -0500 Received: by wesx3 with SMTP id x3so2885147wes.6 for ; Wed, 25 Feb 2015 03:15:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=bqK8nlelgP0jKIufiLzwIbtWIGi/+SM6AIuR1Zjg5Ks=; b=QfeoZoZXZsiMmsrf83pOFt9Ey4PSCwXqnaKrZsbc78IzYrQrG9wXzUn6ZB+Bz9xekA 4TRTwZ0JFL75zWboAl90EwxihIEXb2BMrvaQZXb+HwIoNGXJmXOJmgToJeM9qtg8wXPb iaLvEv4p7AwJnHuv917ji8g2WiCjjSc3Loc+IgPi8OYHK9/JSsACJksMZ5yK4OPbZSjw kz7QNKifERCgX98CpCX7lUQHCT2GBPzwMzeldgAo9RKCPihGGsFiI6vFSwVQby6cnMGV eCzv1Ab5D4+1ngjgyFezVWmKGls/hycgyQAaLyRdbhQ1SO9KF30mJ1Pl1Z07KlobstUr hstw== MIME-Version: 1.0 X-Received: by 10.194.200.68 with SMTP id jq4mr5388672wjc.58.1424862930221; Wed, 25 Feb 2015 03:15:30 -0800 (PST) Received: by 10.194.154.229 with HTTP; Wed, 25 Feb 2015 03:15:30 -0800 (PST) In-Reply-To: References: Date: Wed, 25 Feb 2015 14:15:30 +0300 Message-ID: To: Thomas Gielfeldt Cc: Benjamin Eberlei , PHP Internals Content-Type: multipart/alternative; boundary=047d7b86ea96cf4118050fe7c01c Subject: Re: [PHP-DEV] Feature request and RFC From: lisachenko.it@gmail.com (Alexander Lisachenko) --047d7b86ea96cf4118050fe7c01c Content-Type: text/plain; charset=UTF-8 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 {} --047d7b86ea96cf4118050fe7c01c--