[Pkg-owncloud-commits] [php-sabredav] 70/275: Invokable pathFilter() without using __call()

David Prévot taffit at moszumanska.debian.org
Thu Sep 25 14:55:53 UTC 2014


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

taffit pushed a commit to branch master
in repository php-sabredav.

commit 303fe20366aebaa4eb34c16ae581dde7e999cf45
Author: Dominik Tobschall <dominik at fruux.com>
Date:   Thu Jun 26 15:46:49 2014 +0200

    Invokable pathFilter() without using __call()
---
 lib/DAV/PropertyStorage/Plugin.php | 31 +++++++++----------------------
 1 file changed, 9 insertions(+), 22 deletions(-)

diff --git a/lib/DAV/PropertyStorage/Plugin.php b/lib/DAV/PropertyStorage/Plugin.php
index 274bb81..ff8bec5 100644
--- a/lib/DAV/PropertyStorage/Plugin.php
+++ b/lib/DAV/PropertyStorage/Plugin.php
@@ -34,23 +34,6 @@ class Plugin extends ServerPlugin {
     }
 
     /**
-     * This method is triggered when an inaccessible method
-     * is invoked in the context of this object.
-     *
-     * Allows us to call $this->pathFilter() as a method.
-     *
-     * @param  string $method
-     * @param  array $args
-     * @return void|callable
-     */
-    public function __call($method, $args)
-    {
-        if (is_callable([$this, $method])) {
-            return call_user_func_array($this->$method, $args);
-        }
-    }
-
-    /**
      * This initializes the plugin.
      *
      * This function is called by Sabre\DAV\Server, after
@@ -83,7 +66,8 @@ class Plugin extends ServerPlugin {
     public function propFind(PropFind $propFind, INode $node) {
 
         $path = $propFind->getPath();
-        if ($this->pathFilter && !$this->pathFilter($path)) return;
+        $pathFilter = $this->pathFilter;
+        if ($pathFilter && !$pathFilter($path)) return;
         $this->backend->propFind($propFind->getPath(), $propFind);
 
     }
@@ -100,7 +84,8 @@ class Plugin extends ServerPlugin {
      */
     public function propPatch($path, PropPatch $propPatch) {
 
-        if ($this->pathFilter && !$this->pathFilter($path)) return;
+        $pathFilter = $this->pathFilter;
+        if ($pathFilter && !$pathFilter($path)) return;
         $this->backend->propPatch($path, $propPatch);
 
     }
@@ -116,7 +101,8 @@ class Plugin extends ServerPlugin {
      */
     public function afterUnbind($path) {
 
-        if ($this->pathFilter && !$this->pathFilter($path)) return;
+        $pathFilter = $this->pathFilter;
+        if ($pathFilter && !$pathFilter($path)) return;
         $this->backend->delete($path);
 
     }
@@ -132,10 +118,11 @@ class Plugin extends ServerPlugin {
      */
     public function afterMove($source, $destination) {
 
-        if ($this->pathFilter && !$this->pathFilter($source)) return;
+        $pathFilter = $this->pathFilter;
+        if ($pathFilter && !$pathFilter($source)) return;
         // If the destination is filtered, afterUnbind will handle cleaning up
         // the properties.
-        if ($this->pathFilter && !$this->pathFilter($destination)) return;
+        if ($pathFilter && !$pathFilter($destination)) return;
 
         $this->backend->move($source, $destination);
 

-- 
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