[Pkg-owncloud-commits] [php-sabredav] 37/66: Remove PHP5.2 code.

David Prévot taffit at moszumanska.debian.org
Wed May 27 13:56:49 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to tag 3.0.0-alpha1
in repository php-sabredav.

commit b508190e1c1e37083d8e2550f0ce2f7187ba2ad2
Author: Ivan Enderlin <ivan.enderlin at hoa-project.net>
Date:   Mon Apr 27 14:33:34 2015 +0200

    Remove PHP5.2 code.
---
 lib/DAVACL/Plugin.php | 55 ++++++++++++++++++++++++---------------------------
 1 file changed, 26 insertions(+), 29 deletions(-)

diff --git a/lib/DAVACL/Plugin.php b/lib/DAVACL/Plugin.php
index 1946e17..59f8b37 100644
--- a/lib/DAVACL/Plugin.php
+++ b/lib/DAVACL/Plugin.php
@@ -416,47 +416,44 @@ class Plugin extends DAV\ServerPlugin {
 
         $privs = $this->getSupportedPrivilegeSet($node);
 
-        $flat = [];
-        $this->getFPSTraverse($privs, null, $flat);
+        $fpsTraverse = null;
+        $fpsTraverse = function ($priv, $concrete, &$flat) use (&$fpsTraverse) {
+
+            $myPriv = [
+                'privilege'  => $priv['privilege'],
+                'abstract'   => isset($priv['abstract']) && $priv['abstract'],
+                'aggregates' => [],
+                'concrete'   => isset($priv['abstract']) && $priv['abstract']?$concrete:$priv['privilege'],
+            ];
 
-        return $flat;
+            if (isset($priv['aggregates'])) {
 
-    }
+                foreach($priv['aggregates'] as $subPriv) {
 
-    /**
-     * Traverses the privilege set tree for reordering
-     *
-     * This function is solely used by getFlatPrivilegeSet, and would have been
-     * a closure if it wasn't for the fact I need to support PHP 5.2.
-     *
-     * @param array $priv
-     * @param $concrete
-     * @param array $flat
-     * @return void
-     */
-    final private function getFPSTraverse($priv, $concrete, &$flat) {
+                    $myPriv['aggregates'][] = $subPriv['privilege'];
 
-        $myPriv = [
-            'privilege' => $priv['privilege'],
-            'abstract' => isset($priv['abstract']) && $priv['abstract'],
-            'aggregates' => [],
-            'concrete' => isset($priv['abstract']) && $priv['abstract']?$concrete:$priv['privilege'],
-        ];
+                }
 
-        if (isset($priv['aggregates']))
-            foreach($priv['aggregates'] as $subPriv) $myPriv['aggregates'][] = $subPriv['privilege'];
+            }
 
-        $flat[$priv['privilege']] = $myPriv;
+            $flat[$priv['privilege']] = $myPriv;
 
-        if (isset($priv['aggregates'])) {
+            if (isset($priv['aggregates'])) {
 
-            foreach($priv['aggregates'] as $subPriv) {
+                foreach($priv['aggregates'] as $subPriv) {
 
-                $this->getFPSTraverse($subPriv, $myPriv['concrete'], $flat);
+                    $fpsTraverse($subPriv, $myPriv['concrete'], $flat);
+
+                }
 
             }
 
-        }
+        };
+
+        $flat = [];
+        $fpsTraverse($privs, null, $flat);
+
+        return $flat;
 
     }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabredav.git



More information about the Pkg-owncloud-commits mailing list