[Pkg-owncloud-commits] [php-sabredav] 49/66: Fixed CS.

David Prévot taffit at moszumanska.debian.org
Wed May 27 13:56:55 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 8a4ccd775e5daa2da26ba6c7aefb2a3f4984f74b
Author: Evert Pot <me at evertpot.com>
Date:   Wed Apr 29 17:37:16 2015 -0400

    Fixed CS.
    
    Officially in love with php-cs-fixer. <3
---
 lib/DAVACL/FS/Collection.php                 | 26 ++++++------
 lib/DAVACL/FS/File.php                       | 23 +++++------
 lib/DAVACL/FS/HomeCollection.php             | 23 +++++------
 tests/Sabre/DAVACL/FS/HomeCollectionTest.php |  4 +-
 tests/Sabre/DAVACL/PrincipalBackend/Mock.php | 62 ++++++++++++++--------------
 5 files changed, 68 insertions(+), 70 deletions(-)

diff --git a/lib/DAVACL/FS/Collection.php b/lib/DAVACL/FS/Collection.php
index 0b91e45..ef8f835 100644
--- a/lib/DAVACL/FS/Collection.php
+++ b/lib/DAVACL/FS/Collection.php
@@ -9,33 +9,33 @@ use Sabre\DAV\Exception\NotFound;
 
 /**
  * This is an ACL-enabled collection.
- * 
+ *
  * @copyright Copyright (C) 2007-2015 fruux GmbH. (https://fruux.com/)
- * @author Evert Pot (http://evertpot.com/) 
+ * @author Evert Pot (http://evertpot.com/)
  * @license http://sabre.io/license/ Modified BSD License
  */
 class Collection extends BaseCollection implements IACL {
 
     /**
-     * A list of ACL rules. 
-     * 
-     * @var array 
+     * A list of ACL rules.
+     *
+     * @var array
      */
     protected $acl;
 
     /**
-     * Owner uri, or null for no owner. 
-     * 
+     * Owner uri, or null for no owner.
+     *
      * @var string|null
      */
     protected $owner;
 
     /**
      * Constructor
-     * 
-     * @param string $path on-disk path. 
-     * @param array $acl ACL rules. 
-     * @param string|null $owner principal owner string. 
+     *
+     * @param string $path on-disk path.
+     * @param array $acl ACL rules.
+     * @param string|null $owner principal owner string.
      */
     function __construct($path, array $acl, $owner = null) {
 
@@ -60,11 +60,11 @@ class Collection extends BaseCollection implements IACL {
         $path = $this->path . '/' . $name;
 
         if (!file_exists($path)) throw new NotFound('File could not be located');
-        if ($name=='.' || $name=='..') throw new Forbidden('Permission denied to . and ..');
+        if ($name == '.' || $name == '..') throw new Forbidden('Permission denied to . and ..');
 
         if (is_dir($path)) {
 
-            return new Collection($path, $this->acl, $this->owner);
+            return new self($path, $this->acl, $this->owner);
 
         } else {
 
diff --git a/lib/DAVACL/FS/File.php b/lib/DAVACL/FS/File.php
index 40f78a0..6340563 100644
--- a/lib/DAVACL/FS/File.php
+++ b/lib/DAVACL/FS/File.php
@@ -5,37 +5,36 @@ namespace Sabre\DAVACL\FS;
 use Sabre\DAV\FSExt\File as BaseFile;
 use Sabre\DAVACL\IACL;
 use Sabre\DAV\Exception\Forbidden;
-use Sabre\DAV\Exception\NotFound;
 
 /**
  * This is an ACL-enabled file node.
- * 
+ *
  * @copyright Copyright (C) 2007-2015 fruux GmbH. (https://fruux.com/)
- * @author Evert Pot (http://evertpot.com/) 
+ * @author Evert Pot (http://evertpot.com/)
  * @license http://sabre.io/license/ Modified BSD License
  */
 class File extends BaseFile implements IACL {
 
     /**
-     * A list of ACL rules. 
-     * 
-     * @var array 
+     * A list of ACL rules.
+     *
+     * @var array
      */
     protected $acl;
 
     /**
-     * Owner uri, or null for no owner. 
-     * 
+     * Owner uri, or null for no owner.
+     *
      * @var string|null
      */
     protected $owner;
 
     /**
      * Constructor
-     * 
-     * @param string $path on-disk path. 
-     * @param array $acl ACL rules. 
-     * @param string|null $owner principal owner string. 
+     *
+     * @param string $path on-disk path.
+     * @param array $acl ACL rules.
+     * @param string|null $owner principal owner string.
      */
     function __construct($path, array $acl, $owner = null) {
 
diff --git a/lib/DAVACL/FS/HomeCollection.php b/lib/DAVACL/FS/HomeCollection.php
index f9403ea..5322079 100644
--- a/lib/DAVACL/FS/HomeCollection.php
+++ b/lib/DAVACL/FS/HomeCollection.php
@@ -8,7 +8,6 @@ use Sabre\DAVACL\IACL;
 use Sabre\DAVACL\PrincipalBackend\BackendInterface;
 use Sabre\Uri;
 
-
 /**
  * This collection contains a collection for every principal.
  * It is similar to /home on many unix systems.
@@ -24,24 +23,24 @@ class HomeCollection extends AbstractPrincipalCollection implements IACL {
 
     /**
      * Name of this collection.
-     * 
+     *
      * @var string
      */
     public $collectionName = 'home';
 
     /**
      * Path to where the users' files are actually stored.
-     * 
-     * @var string 
+     *
+     * @var string
      */
     protected $storagePath;
 
     /**
-     * Creates the home collection. 
-     * 
-     * @param BackendInterface $principalBackend 
+     * Creates the home collection.
+     *
+     * @param BackendInterface $principalBackend
      * @param string $storagePath Where the actual files are stored.
-     * @param string $principalPrefix list of principals to iterate. 
+     * @param string $principalPrefix list of principals to iterate.
      */
     function __construct(BackendInterface $principalBackend, $storagePath, $principalPrefix = 'principals') {
 
@@ -64,13 +63,13 @@ class HomeCollection extends AbstractPrincipalCollection implements IACL {
     }
 
     /**
-     * Returns a principals' collection of files.  
+     * Returns a principals' collection of files.
      *
      * The passed array contains principal information, and is guaranteed to
      * at least contain a uri item. Other properties may or may not be
      * supplied by the authentication backend.
      *
-     * @param array $principalInfo 
+     * @param array $principalInfo
      * @return void
      */
     function getChildForPrincipal(array $principalInfo) {
@@ -89,12 +88,12 @@ class HomeCollection extends AbstractPrincipalCollection implements IACL {
             ],
         ];
 
-        list(,$principalBaseName) = Uri\split($owner);
+        list(, $principalBaseName) = Uri\split($owner);
         
         $path = $this->storagePath . '/' . $principalBaseName;
 
         if (!is_dir($path)) {
-            mkdir($path,0777,true);
+            mkdir($path, 0777, true);
         }
         return new Collection(
             $path,
diff --git a/tests/Sabre/DAVACL/FS/HomeCollectionTest.php b/tests/Sabre/DAVACL/FS/HomeCollectionTest.php
index cccfc90..0f9c65a 100644
--- a/tests/Sabre/DAVACL/FS/HomeCollectionTest.php
+++ b/tests/Sabre/DAVACL/FS/HomeCollectionTest.php
@@ -9,7 +9,7 @@ class HomeCollectionTest extends \PHPUnit_Framework_TestCase {
     /**
      * System under test
      *
-     * @var HomeCollection 
+     * @var HomeCollection
      */
     protected $sut;
 
@@ -32,7 +32,7 @@ class HomeCollectionTest extends \PHPUnit_Framework_TestCase {
 
         \Sabre\TestUtil::clearTempDir();
 
-    } 
+    }
 
     function testGetName() {
 
diff --git a/tests/Sabre/DAVACL/PrincipalBackend/Mock.php b/tests/Sabre/DAVACL/PrincipalBackend/Mock.php
index 19ef644..afb094a 100644
--- a/tests/Sabre/DAVACL/PrincipalBackend/Mock.php
+++ b/tests/Sabre/DAVACL/PrincipalBackend/Mock.php
@@ -4,7 +4,7 @@ namespace Sabre\DAVACL\PrincipalBackend;
 
 class Mock extends AbstractBackend {
 
-    public $groupMembers = array();
+    public $groupMembers = [];
     public $principals;
 
     function __construct(array $principals = null) {
@@ -13,23 +13,23 @@ class Mock extends AbstractBackend {
 
         if (is_null($principals)) {
 
-            $this->principals = array(
-                array(
-                    'uri' => 'principals/user1',
-                    '{DAV:}displayname' => 'User 1',
+            $this->principals = [
+                [
+                    'uri'                                   => 'principals/user1',
+                    '{DAV:}displayname'                     => 'User 1',
                     '{http://sabredav.org/ns}email-address' => 'user1.sabredav at sabredav.org',
-                    '{http://sabredav.org/ns}vcard-url' => 'addressbooks/user1/book1/vcard1.vcf',
-                ),
-                array(
-                    'uri' => 'principals/admin',
+                    '{http://sabredav.org/ns}vcard-url'     => 'addressbooks/user1/book1/vcard1.vcf',
+                ],
+                [
+                    'uri'               => 'principals/admin',
                     '{DAV:}displayname' => 'Admin',
-                ),
-                array(
-                    'uri' => 'principals/user2',
-                    '{DAV:}displayname' => 'User 2',
+                ],
+                [
+                    'uri'                                   => 'principals/user2',
+                    '{DAV:}displayname'                     => 'User 2',
                     '{http://sabredav.org/ns}email-address' => 'user2.sabredav at sabredav.org',
-                ),
-            );
+                ],
+            ];
 
         }
 
@@ -37,13 +37,13 @@ class Mock extends AbstractBackend {
 
     function getPrincipalsByPrefix($prefix) {
 
-        $prefix = trim($prefix,'/');
-        if ($prefix) $prefix.='/';
-        $return = array();
+        $prefix = trim($prefix, '/');
+        if ($prefix) $prefix .= '/';
+        $return = [];
 
-        foreach($this->principals as $principal) {
+        foreach ($this->principals as $principal) {
 
-            if ($prefix && strpos($principal['uri'], $prefix)!==0) continue;
+            if ($prefix && strpos($principal['uri'], $prefix) !== 0) continue;
 
             $return[] = $principal;
 
@@ -61,7 +61,7 @@ class Mock extends AbstractBackend {
 
     function getPrincipalByPath($path) {
 
-        foreach($this->getPrincipalsByPrefix('principals') as $principal) {
+        foreach ($this->getPrincipalsByPrefix('principals') as $principal) {
             if ($principal['uri'] === $path) return $principal;
         }
 
@@ -69,15 +69,15 @@ class Mock extends AbstractBackend {
 
     function searchPrincipals($prefixPath, array $searchProperties, $test = 'allof') {
 
-        $matches = array();
-        foreach($this->getPrincipalsByPrefix($prefixPath) as $principal) {
+        $matches = [];
+        foreach ($this->getPrincipalsByPrefix($prefixPath) as $principal) {
 
-            foreach($searchProperties as $key=>$value) {
+            foreach ($searchProperties as $key => $value) {
 
                 if (!isset($principal[$key])) {
                     continue 2;
                 }
-                if (mb_stripos($principal[$key],$value, 0, 'UTF-8')===false) {
+                if (mb_stripos($principal[$key], $value, 0, 'UTF-8') === false) {
                     continue 2;
                 }
 
@@ -98,14 +98,14 @@ class Mock extends AbstractBackend {
 
     function getGroupMemberSet($path) {
 
-        return isset($this->groupMembers[$path]) ? $this->groupMembers[$path] : array();
+        return isset($this->groupMembers[$path]) ? $this->groupMembers[$path] : [];
 
     }
 
     function getGroupMembership($path) {
 
-        $membership = array();
-        foreach($this->groupMembers as $group=>$members) {
+        $membership = [];
+        foreach ($this->groupMembers as $group => $members) {
             if (in_array($path, $members)) $membership[] = $group;
         }
         return $membership;
@@ -133,10 +133,10 @@ class Mock extends AbstractBackend {
      * @param string $path
      * @param \Sabre\DAV\PropPatch $propPatch
      */
-    public function updatePrincipal($path, \Sabre\DAV\PropPatch $propPatch) {
+    function updatePrincipal($path, \Sabre\DAV\PropPatch $propPatch) {
 
         $value = null;
-        foreach($this->principals as $principalIndex=>$value) {
+        foreach ($this->principals as $principalIndex => $value) {
             if ($value['uri'] === $path) {
                 $principal = $value;
                 break;
@@ -146,7 +146,7 @@ class Mock extends AbstractBackend {
 
         $propPatch->handleRemaining(function($mutations) use ($principal, $principalIndex) {
 
-            foreach($mutations as $prop=>$value) {
+            foreach ($mutations as $prop => $value) {
 
                 if (is_null($value) && isset($principal[$prop])) {
                     unset($principal[$prop]);

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