[Pkg-owncloud-commits] [php-sabredav] 201/275: New coding standards.
David Prévot
taffit at moszumanska.debian.org
Thu Sep 25 14:56:08 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 5ad922abe9d2e44720ec5a4c0191ba32bc2eb98a
Author: Evert Pot <evert at rooftopsolutions.nl>
Date: Thu Aug 28 09:19:54 2014 +0200
New coding standards.
---
lib/DAVACL/AbstractPrincipalCollection.php | 14 +--
lib/DAVACL/Exception/AceConflict.php | 2 +-
lib/DAVACL/Exception/NeedPrivileges.php | 4 +-
lib/DAVACL/Exception/NoAbstract.php | 2 +-
lib/DAVACL/Exception/NotRecognizedPrincipal.php | 2 +-
lib/DAVACL/Exception/NotSupportedPrivilege.php | 2 +-
lib/DAVACL/Plugin.php | 118 ++++++++++++------------
lib/DAVACL/Principal.php | 34 +++----
lib/DAVACL/PrincipalBackend/PDO.php | 74 +++++++--------
lib/DAVACL/PrincipalCollection.php | 2 +-
lib/DAVACL/Property/Acl.php | 6 +-
lib/DAVACL/Property/CurrentUserPrivilegeSet.php | 12 +--
lib/DAVACL/Property/Principal.php | 10 +-
lib/DAVACL/Property/SupportedPrivilegeSet.php | 6 +-
14 files changed, 146 insertions(+), 142 deletions(-)
diff --git a/lib/DAVACL/AbstractPrincipalCollection.php b/lib/DAVACL/AbstractPrincipalCollection.php
index 9f7d4af..6b58e9d 100644
--- a/lib/DAVACL/AbstractPrincipalCollection.php
+++ b/lib/DAVACL/AbstractPrincipalCollection.php
@@ -54,7 +54,7 @@ abstract class AbstractPrincipalCollection extends DAV\Collection implements IPr
* @param PrincipalBackend\BackendInterface $principalBackend
* @param string $principalPrefix
*/
- public function __construct(PrincipalBackend\BackendInterface $principalBackend, $principalPrefix = 'principals') {
+ function __construct(PrincipalBackend\BackendInterface $principalBackend, $principalPrefix = 'principals') {
$this->principalPrefix = $principalPrefix;
$this->principalBackend = $principalBackend;
@@ -78,7 +78,7 @@ abstract class AbstractPrincipalCollection extends DAV\Collection implements IPr
*
* @return string
*/
- public function getName() {
+ function getName() {
list(,$name) = URLUtil::splitPath($this->principalPrefix);
return $name;
@@ -90,12 +90,12 @@ abstract class AbstractPrincipalCollection extends DAV\Collection implements IPr
*
* @return array
*/
- public function getChildren() {
+ function getChildren() {
if ($this->disableListing)
throw new DAV\Exception\MethodNotAllowed('Listing members of this collection is disabled');
- $children = array();
+ $children = [];
foreach($this->principalBackend->getPrincipalsByPrefix($this->principalPrefix) as $principalInfo) {
$children[] = $this->getChildForPrincipal($principalInfo);
@@ -113,7 +113,7 @@ abstract class AbstractPrincipalCollection extends DAV\Collection implements IPr
* @throws DAV\Exception\NotFound
* @return IPrincipal
*/
- public function getChild($name) {
+ function getChild($name) {
$principalInfo = $this->principalBackend->getPrincipalByPath($this->principalPrefix . '/' . $name);
if (!$principalInfo) throw new DAV\Exception\NotFound('Principal with name ' . $name . ' not found');
@@ -142,10 +142,10 @@ abstract class AbstractPrincipalCollection extends DAV\Collection implements IPr
* @param array $searchProperties
* @return array
*/
- public function searchPrincipals(array $searchProperties) {
+ function searchPrincipals(array $searchProperties) {
$result = $this->principalBackend->searchPrincipals($this->principalPrefix, $searchProperties);
- $r = array();
+ $r = [];
foreach($result as $row) {
list(, $r[]) = URLUtil::splitPath($row);
diff --git a/lib/DAVACL/Exception/AceConflict.php b/lib/DAVACL/Exception/AceConflict.php
index 6ee9afd..e22a8ec 100644
--- a/lib/DAVACL/Exception/AceConflict.php
+++ b/lib/DAVACL/Exception/AceConflict.php
@@ -23,7 +23,7 @@ class AceConflict extends DAV\Exception\Conflict {
* @param \DOMElement $errorNode
* @return void
*/
- public function serialize(DAV\Server $server,\DOMElement $errorNode) {
+ function serialize(DAV\Server $server,\DOMElement $errorNode) {
$doc = $errorNode->ownerDocument;
diff --git a/lib/DAVACL/Exception/NeedPrivileges.php b/lib/DAVACL/Exception/NeedPrivileges.php
index f7e4358..5a17b7c 100644
--- a/lib/DAVACL/Exception/NeedPrivileges.php
+++ b/lib/DAVACL/Exception/NeedPrivileges.php
@@ -36,7 +36,7 @@ class NeedPrivileges extends DAV\Exception\Forbidden {
* @param string $uri
* @param array $privileges
*/
- public function __construct($uri,array $privileges) {
+ function __construct($uri,array $privileges) {
$this->uri = $uri;
$this->privileges = $privileges;
@@ -54,7 +54,7 @@ class NeedPrivileges extends DAV\Exception\Forbidden {
* @param \DOMElement $errorNode
* @return void
*/
- public function serialize(DAV\Server $server,\DOMElement $errorNode) {
+ function serialize(DAV\Server $server,\DOMElement $errorNode) {
$doc = $errorNode->ownerDocument;
diff --git a/lib/DAVACL/Exception/NoAbstract.php b/lib/DAVACL/Exception/NoAbstract.php
index ba6f76c..7843728 100644
--- a/lib/DAVACL/Exception/NoAbstract.php
+++ b/lib/DAVACL/Exception/NoAbstract.php
@@ -23,7 +23,7 @@ class NoAbstract extends DAV\Exception\PreconditionFailed {
* @param \DOMElement $errorNode
* @return void
*/
- public function serialize(DAV\Server $server,\DOMElement $errorNode) {
+ function serialize(DAV\Server $server,\DOMElement $errorNode) {
$doc = $errorNode->ownerDocument;
diff --git a/lib/DAVACL/Exception/NotRecognizedPrincipal.php b/lib/DAVACL/Exception/NotRecognizedPrincipal.php
index f61edef..0ae3ad2 100644
--- a/lib/DAVACL/Exception/NotRecognizedPrincipal.php
+++ b/lib/DAVACL/Exception/NotRecognizedPrincipal.php
@@ -23,7 +23,7 @@ class NotRecognizedPrincipal extends DAV\Exception\PreconditionFailed {
* @param \DOMElement $errorNode
* @return void
*/
- public function serialize(DAV\Server $server,\DOMElement $errorNode) {
+ function serialize(DAV\Server $server,\DOMElement $errorNode) {
$doc = $errorNode->ownerDocument;
diff --git a/lib/DAVACL/Exception/NotSupportedPrivilege.php b/lib/DAVACL/Exception/NotSupportedPrivilege.php
index 6d30698..8f824d0 100644
--- a/lib/DAVACL/Exception/NotSupportedPrivilege.php
+++ b/lib/DAVACL/Exception/NotSupportedPrivilege.php
@@ -23,7 +23,7 @@ class NotSupportedPrivilege extends DAV\Exception\PreconditionFailed {
* @param \DOMElement $errorNode
* @return void
*/
- public function serialize(DAV\Server $server,\DOMElement $errorNode) {
+ function serialize(DAV\Server $server,\DOMElement $errorNode) {
$doc = $errorNode->ownerDocument;
diff --git a/lib/DAVACL/Plugin.php b/lib/DAVACL/Plugin.php
index bb6a675..7fe452e 100644
--- a/lib/DAVACL/Plugin.php
+++ b/lib/DAVACL/Plugin.php
@@ -60,9 +60,9 @@ class Plugin extends DAV\ServerPlugin {
*
* @var array
*/
- public $principalCollectionSet = array(
+ public $principalCollectionSet = [
'principals',
- );
+ ];
/**
* By default ACL is only enforced for nodes that have ACL support (the
@@ -104,10 +104,10 @@ class Plugin extends DAV\ServerPlugin {
*
* @var array
*/
- public $principalSearchPropertySet = array(
+ public $principalSearchPropertySet = [
'{DAV:}displayname' => 'Display name',
'{http://sabredav.org/ns}email-address' => 'Email address',
- );
+ ];
/**
* Any principal uri's added here, will automatically be added to the list
@@ -116,7 +116,7 @@ class Plugin extends DAV\ServerPlugin {
*
* @var array
*/
- public $adminPrincipals = array();
+ public $adminPrincipals = [];
/**
* Returns a list of features added by this plugin.
@@ -125,9 +125,9 @@ class Plugin extends DAV\ServerPlugin {
*
* @return array
*/
- public function getFeatures() {
+ function getFeatures() {
- return array('access-control', 'calendarserver-principal-property-search');
+ return ['access-control', 'calendarserver-principal-property-search'];
}
@@ -137,9 +137,9 @@ class Plugin extends DAV\ServerPlugin {
* @param string $uri
* @return array
*/
- public function getMethods($uri) {
+ function getMethods($uri) {
- return array('ACL');
+ return ['ACL'];
}
@@ -151,7 +151,7 @@ class Plugin extends DAV\ServerPlugin {
*
* @return string
*/
- public function getPluginName() {
+ function getPluginName() {
return 'acl';
@@ -167,13 +167,13 @@ class Plugin extends DAV\ServerPlugin {
* @param string $uri
* @return array
*/
- public function getSupportedReportSet($uri) {
+ function getSupportedReportSet($uri) {
- return array(
+ return [
'{DAV:}expand-property',
'{DAV:}principal-property-search',
'{DAV:}principal-search-property-set',
- );
+ ];
}
@@ -192,9 +192,9 @@ class Plugin extends DAV\ServerPlugin {
* @throws Sabre\DAVACL\Exception\NeedPrivileges
* @return bool
*/
- public function checkPrivileges($uri, $privileges, $recursion = self::R_PARENT, $throwExceptions = true) {
+ function checkPrivileges($uri, $privileges, $recursion = self::R_PARENT, $throwExceptions = true) {
- if (!is_array($privileges)) $privileges = array($privileges);
+ if (!is_array($privileges)) $privileges = [$privileges];
$acl = $this->getCurrentUserPrivilegeSet($uri);
@@ -210,7 +210,7 @@ class Plugin extends DAV\ServerPlugin {
}
}
- $failed = array();
+ $failed = [];
foreach($privileges as $priv) {
if (!in_array($priv, $acl)) {
@@ -237,7 +237,7 @@ class Plugin extends DAV\ServerPlugin {
*
* @return string|null
*/
- public function getCurrentUserPrincipal() {
+ function getCurrentUserPrincipal() {
$authPlugin = $this->server->getPlugin('auth');
if (is_null($authPlugin)) return null;
@@ -257,14 +257,14 @@ class Plugin extends DAV\ServerPlugin {
*
* @return array
*/
- public function getCurrentUserPrincipals() {
+ function getCurrentUserPrincipals() {
$currentUser = $this->getCurrentUserPrincipal();
- if (is_null($currentUser)) return array();
+ if (is_null($currentUser)) return [];
return array_merge(
- array($currentUser),
+ [$currentUser],
$this->getPrincipalMembership($currentUser)
);
@@ -276,7 +276,7 @@ class Plugin extends DAV\ServerPlugin {
*
* @var array
*/
- protected $principalMembershipCache = array();
+ protected $principalMembershipCache = [];
/**
@@ -285,15 +285,15 @@ class Plugin extends DAV\ServerPlugin {
* @param string $principal
* @return array
*/
- public function getPrincipalMembership($mainPrincipal) {
+ function getPrincipalMembership($mainPrincipal) {
// First check our cache
if (isset($this->principalMembershipCache[$mainPrincipal])) {
return $this->principalMembershipCache[$mainPrincipal];
}
- $check = array($mainPrincipal);
- $principals = array();
+ $check = [$mainPrincipal];
+ $principals = [];
while(count($check)) {
@@ -335,7 +335,7 @@ class Plugin extends DAV\ServerPlugin {
* @param string|INode $node
* @return array
*/
- public function getSupportedPrivilegeSet($node) {
+ function getSupportedPrivilegeSet($node) {
if (is_string($node)) {
$node = $this->server->tree->getNodeForPath($node);
@@ -425,7 +425,7 @@ class Plugin extends DAV\ServerPlugin {
* @param string|INode $node
* @return array
*/
- final public function getFlatPrivilegeSet($node) {
+ final function getFlatPrivilegeSet($node) {
$privs = $this->getSupportedPrivilegeSet($node);
@@ -449,12 +449,12 @@ class Plugin extends DAV\ServerPlugin {
*/
final private function getFPSTraverse($priv, $concrete, &$flat) {
- $myPriv = array(
+ $myPriv = [
'privilege' => $priv['privilege'],
'abstract' => isset($priv['abstract']) && $priv['abstract'],
- 'aggregates' => array(),
+ 'aggregates' => [],
'concrete' => isset($priv['abstract']) && $priv['abstract']?$concrete:$priv['privilege'],
- );
+ ];
if (isset($priv['aggregates']))
foreach($priv['aggregates'] as $subPriv) $myPriv['aggregates'][] = $subPriv['privilege'];
@@ -483,7 +483,7 @@ class Plugin extends DAV\ServerPlugin {
* @param string|DAV\INode $node
* @return array
*/
- public function getACL($node) {
+ function getACL($node) {
if (is_string($node)) {
$node = $this->server->tree->getNodeForPath($node);
@@ -493,11 +493,11 @@ class Plugin extends DAV\ServerPlugin {
}
$acl = $node->getACL();
foreach($this->adminPrincipals as $adminPrincipal) {
- $acl[] = array(
+ $acl[] = [
'principal' => $adminPrincipal,
'privilege' => '{DAV:}all',
'protected' => true,
- );
+ ];
}
return $acl;
@@ -514,7 +514,7 @@ class Plugin extends DAV\ServerPlugin {
* @param string|DAV\INode $node
* @return array
*/
- public function getCurrentUserPrivilegeSet($node) {
+ function getCurrentUserPrivilegeSet($node) {
if (is_string($node)) {
$node = $this->server->tree->getNodeForPath($node);
@@ -526,7 +526,7 @@ class Plugin extends DAV\ServerPlugin {
$principals = $this->getCurrentUserPrincipals();
- $collected = array();
+ $collected = [];
foreach($acl as $ace) {
@@ -571,7 +571,7 @@ class Plugin extends DAV\ServerPlugin {
// Now we deduct all aggregated privileges.
$flat = $this->getFlatPrivilegeSet($node);
- $collected2 = array();
+ $collected2 = [];
while(count($collected)) {
$current = array_pop($collected);
@@ -598,7 +598,7 @@ class Plugin extends DAV\ServerPlugin {
*
* @return string|bool
*/
- public function getPrincipalByEmail($email) {
+ function getPrincipalByEmail($email) {
$result = $this->principalSearch(
['{http://sabredav.org/ns}email-address' => $email],
@@ -635,15 +635,15 @@ class Plugin extends DAV\ServerPlugin {
* properties are index by a HTTP status code.
*
*/
- public function principalSearch(array $searchProperties, array $requestedProperties, $collectionUri = null) {
+ function principalSearch(array $searchProperties, array $requestedProperties, $collectionUri = null) {
if (!is_null($collectionUri)) {
- $uris = array($collectionUri);
+ $uris = [$collectionUri];
} else {
$uris = $this->principalCollectionSet;
}
- $lookupResults = array();
+ $lookupResults = [];
foreach($uris as $uri) {
$principalCollection = $this->server->tree->getNodeForPath($uri);
@@ -660,7 +660,7 @@ class Plugin extends DAV\ServerPlugin {
}
- $matches = array();
+ $matches = [];
foreach($lookupResults as $lookupResult) {
@@ -680,7 +680,7 @@ class Plugin extends DAV\ServerPlugin {
* @param DAV\Server $server
* @return void
*/
- public function initialize(DAV\Server $server) {
+ function initialize(DAV\Server $server) {
$this->server = $server;
$server->on('propFind', [$this,'propFind'], 20);
@@ -727,7 +727,7 @@ class Plugin extends DAV\ServerPlugin {
* @param ResponseInterface $response
* @return void
*/
- public function beforeMethod(RequestInterface $request, ResponseInterface $response) {
+ function beforeMethod(RequestInterface $request, ResponseInterface $response) {
$method = $request->getMethod();
$path = $request->getPath();
@@ -795,7 +795,7 @@ class Plugin extends DAV\ServerPlugin {
* @param string $uri
* @return void
*/
- public function beforeBind($uri) {
+ function beforeBind($uri) {
list($parentUri,$nodeName) = URLUtil::splitPath($uri);
$this->checkPrivileges($parentUri,'{DAV:}bind');
@@ -811,7 +811,7 @@ class Plugin extends DAV\ServerPlugin {
* @param string $uri
* @return void
*/
- public function beforeUnbind($uri) {
+ function beforeUnbind($uri) {
list($parentUri,$nodeName) = URLUtil::splitPath($uri);
$this->checkPrivileges($parentUri,'{DAV:}unbind',self::R_RECURSIVEPARENTS);
@@ -826,7 +826,7 @@ class Plugin extends DAV\ServerPlugin {
* @TODO: not yet implemented
* @return void
*/
- public function beforeUnlock($uri, DAV\Locks\LockInfo $lock) {
+ function beforeUnlock($uri, DAV\Locks\LockInfo $lock) {
}
@@ -841,7 +841,7 @@ class Plugin extends DAV\ServerPlugin {
* @TODO really should be broken into multiple methods, or even a class.
* @return bool
*/
- public function propFind(DAV\PropFind $propFind, DAV\INode $node) {
+ function propFind(DAV\PropFind $propFind, DAV\INode $node) {
$path = $propFind->getPath();
@@ -952,7 +952,7 @@ class Plugin extends DAV\ServerPlugin {
* @param DAV\PropPatch $propPatch
* @return void
*/
- public function propPatch($path, DAV\PropPatch $propPatch) {
+ function propPatch($path, DAV\PropPatch $propPatch) {
$propPatch->handle('{DAV:}group-member-set', function($value) use ($path) {
if (is_null($value)) {
@@ -974,7 +974,7 @@ class Plugin extends DAV\ServerPlugin {
$node->setGroupMemberSet($memberSet);
// We must also clear our cache, just in case
- $this->principalMembershipCache = array();
+ $this->principalMembershipCache = [];
return true;
});
@@ -988,7 +988,7 @@ class Plugin extends DAV\ServerPlugin {
* @param \DOMNode $dom
* @return bool
*/
- public function report($reportName, $dom) {
+ function report($reportName, $dom) {
switch($reportName) {
@@ -1016,7 +1016,7 @@ class Plugin extends DAV\ServerPlugin {
* @param ResponseInterface $response
* @return bool
*/
- public function httpAcl(RequestInterface $request, ResponseInterface $response) {
+ function httpAcl(RequestInterface $request, ResponseInterface $response) {
$path = $request->getPath();
$body = $request->getBodyAsString();
@@ -1150,7 +1150,7 @@ class Plugin extends DAV\ServerPlugin {
*/
protected function parseExpandPropertyReportRequest($node) {
- $requestedProperties = array();
+ $requestedProperties = [];
do {
if (DAV\XMLUtil::toClarkNotation($node)!=='{DAV:}property') continue;
@@ -1161,7 +1161,7 @@ class Plugin extends DAV\ServerPlugin {
} else {
- $children = array();
+ $children = [];
}
@@ -1190,7 +1190,7 @@ class Plugin extends DAV\ServerPlugin {
$foundProperties = $this->server->getPropertiesForPath($path, array_keys($requestedProperties), $depth);
- $result = array();
+ $result = [];
foreach($foundProperties as $node) {
@@ -1204,12 +1204,12 @@ class Plugin extends DAV\ServerPlugin {
if (!array_key_exists($propertyName,$node[200])) continue;
if ($node[200][$propertyName] instanceof DAV\Property\IHref) {
- $hrefs = array($node[200][$propertyName]->getHref());
+ $hrefs = [$node[200][$propertyName]->getHref()];
} elseif ($node[200][$propertyName] instanceof DAV\Property\HrefList) {
$hrefs = $node[200][$propertyName]->getHrefs();
}
- $childProps = array();
+ $childProps = [];
foreach($hrefs as $href) {
$childProps = array_merge($childProps, $this->expandProperties($href, $childRequestedProperties, 0));
}
@@ -1336,7 +1336,7 @@ class Plugin extends DAV\ServerPlugin {
throw new DAV\Exception\BadRequest('This report is only defined when Depth: 0');
}
- $searchProperties = array();
+ $searchProperties = [];
$applyToPrincipalCollectionSet = false;
@@ -1379,7 +1379,11 @@ class Plugin extends DAV\ServerPlugin {
}
- return array($searchProperties, array_keys(DAV\XMLUtil::parseProperties($dom->firstChild)), $applyToPrincipalCollectionSet);
+ return [
+ $searchProperties,
+ array_keys(DAV\XMLUtil::parseProperties($dom->firstChild)),
+ $applyToPrincipalCollectionSet
+ ];
}
diff --git a/lib/DAVACL/Principal.php b/lib/DAVACL/Principal.php
index 40ddf82..05854fe 100644
--- a/lib/DAVACL/Principal.php
+++ b/lib/DAVACL/Principal.php
@@ -43,7 +43,7 @@ class Principal extends DAV\Node implements IPrincipal, DAV\IProperties, IACL {
* @param IPrincipalBackend $principalBackend
* @param array $principalProperties
*/
- public function __construct(PrincipalBackend\BackendInterface $principalBackend, array $principalProperties = array()) {
+ function __construct(PrincipalBackend\BackendInterface $principalBackend, array $principalProperties = []) {
if (!isset($principalProperties['uri'])) {
throw new DAV\Exception('The principal properties must at least contain the \'uri\' key');
@@ -58,7 +58,7 @@ class Principal extends DAV\Node implements IPrincipal, DAV\IProperties, IACL {
*
* @return string
*/
- public function getPrincipalUrl() {
+ function getPrincipalUrl() {
return $this->principalProperties['uri'];
@@ -71,9 +71,9 @@ class Principal extends DAV\Node implements IPrincipal, DAV\IProperties, IACL {
*
* @return array
*/
- public function getAlternateUriSet() {
+ function getAlternateUriSet() {
- $uris = array();
+ $uris = [];
if (isset($this->principalProperties['{DAV:}alternate-URI-set'])) {
$uris = $this->principalProperties['{DAV:}alternate-URI-set'];
@@ -96,7 +96,7 @@ class Principal extends DAV\Node implements IPrincipal, DAV\IProperties, IACL {
*
* @return array
*/
- public function getGroupMemberSet() {
+ function getGroupMemberSet() {
return $this->principalBackend->getGroupMemberSet($this->principalProperties['uri']);
@@ -110,7 +110,7 @@ class Principal extends DAV\Node implements IPrincipal, DAV\IProperties, IACL {
*
* @return array
*/
- public function getGroupMembership() {
+ function getGroupMembership() {
return $this->principalBackend->getGroupMemberShip($this->principalProperties['uri']);
@@ -128,7 +128,7 @@ class Principal extends DAV\Node implements IPrincipal, DAV\IProperties, IACL {
* @param array $groupMembers
* @return void
*/
- public function setGroupMemberSet(array $groupMembers) {
+ function setGroupMemberSet(array $groupMembers) {
$this->principalBackend->setGroupMemberSet($this->principalProperties['uri'], $groupMembers);
@@ -140,7 +140,7 @@ class Principal extends DAV\Node implements IPrincipal, DAV\IProperties, IACL {
*
* @return string
*/
- public function getName() {
+ function getName() {
$uri = $this->principalProperties['uri'];
list(, $name) = URLUtil::splitPath($uri);
@@ -153,7 +153,7 @@ class Principal extends DAV\Node implements IPrincipal, DAV\IProperties, IACL {
*
* @return string
*/
- public function getDisplayName() {
+ function getDisplayName() {
if (isset($this->principalProperties['{DAV:}displayname'])) {
return $this->principalProperties['{DAV:}displayname'];
@@ -169,9 +169,9 @@ class Principal extends DAV\Node implements IPrincipal, DAV\IProperties, IACL {
* @param array $requestedProperties
* @return array
*/
- public function getProperties($requestedProperties) {
+ function getProperties($requestedProperties) {
- $newProperties = array();
+ $newProperties = [];
foreach($requestedProperties as $propName) {
if (isset($this->principalProperties[$propName])) {
@@ -196,7 +196,7 @@ class Principal extends DAV\Node implements IPrincipal, DAV\IProperties, IACL {
* @param DAV\PropPatch $propPatch
* @return void
*/
- public function propPatch(DAV\PropPatch $propPatch) {
+ function propPatch(DAV\PropPatch $propPatch) {
return $this->principalBackend->updatePrincipal(
$this->principalProperties['uri'],
@@ -212,7 +212,7 @@ class Principal extends DAV\Node implements IPrincipal, DAV\IProperties, IACL {
*
* @return string|null
*/
- public function getOwner() {
+ function getOwner() {
return $this->principalProperties['uri'];
@@ -226,7 +226,7 @@ class Principal extends DAV\Node implements IPrincipal, DAV\IProperties, IACL {
*
* @return string|null
*/
- public function getGroup() {
+ function getGroup() {
return null;
@@ -244,7 +244,7 @@ class Principal extends DAV\Node implements IPrincipal, DAV\IProperties, IACL {
*
* @return array
*/
- public function getACL() {
+ function getACL() {
return [
[
@@ -264,7 +264,7 @@ class Principal extends DAV\Node implements IPrincipal, DAV\IProperties, IACL {
* @param array $acl
* @return void
*/
- public function setACL(array $acl) {
+ function setACL(array $acl) {
throw new DAV\Exception\MethodNotAllowed('Updating ACLs is not allowed here');
@@ -282,7 +282,7 @@ class Principal extends DAV\Node implements IPrincipal, DAV\IProperties, IACL {
*
* @return array|null
*/
- public function getSupportedPrivilegeSet() {
+ function getSupportedPrivilegeSet() {
return null;
diff --git a/lib/DAVACL/PrincipalBackend/PDO.php b/lib/DAVACL/PrincipalBackend/PDO.php
index 2907d45..1ca49fc 100644
--- a/lib/DAVACL/PrincipalBackend/PDO.php
+++ b/lib/DAVACL/PrincipalBackend/PDO.php
@@ -46,14 +46,14 @@ class PDO extends AbstractBackend {
*
* @var array
*/
- protected $fieldMap = array(
+ protected $fieldMap = [
/**
* This property can be used to display the users' real name.
*/
- '{DAV:}displayname' => array(
+ '{DAV:}displayname' => [
'dbField' => 'displayname',
- ),
+ ],
/**
* This property is actually used by the CardDAV plugin, where it gets
@@ -63,16 +63,16 @@ class PDO extends AbstractBackend {
* me-card is defined as a property on the users' addressbook
* collection.
*/
- '{http://sabredav.org/ns}vcard-url' => array(
+ '{http://sabredav.org/ns}vcard-url' => [
'dbField' => 'vcardurl',
- ),
+ ],
/**
* This is the users' primary email-address.
*/
- '{http://sabredav.org/ns}email-address' => array(
+ '{http://sabredav.org/ns}email-address' =>[
'dbField' => 'email',
- ),
- );
+ ],
+ ];
/**
* Sets up the backend.
@@ -81,7 +81,7 @@ class PDO extends AbstractBackend {
* @param string $tableName
* @param string $groupMembersTableName
*/
- public function __construct(\PDO $pdo, $tableName = 'principals', $groupMembersTableName = 'groupmembers') {
+ function __construct(\PDO $pdo, $tableName = 'principals', $groupMembersTableName = 'groupmembers') {
$this->pdo = $pdo;
$this->tableName = $tableName;
@@ -106,18 +106,18 @@ class PDO extends AbstractBackend {
* @param string $prefixPath
* @return array
*/
- public function getPrincipalsByPrefix($prefixPath) {
+ function getPrincipalsByPrefix($prefixPath) {
- $fields = array(
+ $fields = [
'uri',
- );
+ ];
foreach($this->fieldMap as $key=>$value) {
$fields[] = $value['dbField'];
}
$result = $this->pdo->query('SELECT '.implode(',', $fields).' FROM '. $this->tableName);
- $principals = array();
+ $principals = [];
while($row = $result->fetch(\PDO::FETCH_ASSOC)) {
@@ -125,9 +125,9 @@ class PDO extends AbstractBackend {
list($rowPrefix) = URLUtil::splitPath($row['uri']);
if ($rowPrefix !== $prefixPath) continue;
- $principal = array(
+ $principal = [
'uri' => $row['uri'],
- );
+ ];
foreach($this->fieldMap as $key=>$value) {
if ($row[$value['dbField']]) {
$principal[$key] = $row[$value['dbField']];
@@ -149,26 +149,26 @@ class PDO extends AbstractBackend {
* @param string $path
* @return array
*/
- public function getPrincipalByPath($path) {
+ function getPrincipalByPath($path) {
- $fields = array(
+ $fields = [
'id',
'uri',
- );
+ ];
foreach($this->fieldMap as $key=>$value) {
$fields[] = $value['dbField'];
}
$stmt = $this->pdo->prepare('SELECT '.implode(',', $fields).' FROM '. $this->tableName . ' WHERE uri = ?');
- $stmt->execute(array($path));
+ $stmt->execute([$path]);
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
if (!$row) return;
- $principal = array(
+ $principal = [
'id' => $row['id'],
'uri' => $row['uri'],
- );
+ ];
foreach($this->fieldMap as $key=>$value) {
if ($row[$value['dbField']]) {
$principal[$key] = $row[$value['dbField']];
@@ -193,7 +193,7 @@ class PDO 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) {
$propPatch->handle(array_keys($this->fieldMap), function($properties) use ($path) {
@@ -255,10 +255,10 @@ class PDO extends AbstractBackend {
* @param array $searchProperties
* @return array
*/
- public function searchPrincipals($prefixPath, array $searchProperties) {
+ function searchPrincipals($prefixPath, array $searchProperties) {
$query = 'SELECT uri FROM ' . $this->tableName . ' WHERE 1=1 ';
- $values = array();
+ $values = [];
foreach($searchProperties as $property => $value) {
switch($property) {
@@ -273,7 +273,7 @@ class PDO extends AbstractBackend {
break;
default :
// Unsupported property
- return array();
+ return [];
}
@@ -281,7 +281,7 @@ class PDO extends AbstractBackend {
$stmt = $this->pdo->prepare($query);
$stmt->execute($values);
- $principals = array();
+ $principals = [];
while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
// Checking if the principal is in the prefix
@@ -302,15 +302,15 @@ class PDO extends AbstractBackend {
* @param string $principal
* @return array
*/
- public function getGroupMemberSet($principal) {
+ function getGroupMemberSet($principal) {
$principal = $this->getPrincipalByPath($principal);
if (!$principal) throw new DAV\Exception('Principal not found');
$stmt = $this->pdo->prepare('SELECT principals.uri as uri FROM '.$this->groupMembersTableName.' AS groupmembers LEFT JOIN '.$this->tableName.' AS principals ON groupmembers.member_id = principals.id WHERE groupmembers.principal_id = ?');
- $stmt->execute(array($principal['id']));
+ $stmt->execute([$principal['id']]);
- $result = array();
+ $result = [];
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
$result[] = $row['uri'];
}
@@ -324,15 +324,15 @@ class PDO extends AbstractBackend {
* @param string $principal
* @return array
*/
- public function getGroupMembership($principal) {
+ function getGroupMembership($principal) {
$principal = $this->getPrincipalByPath($principal);
if (!$principal) throw new DAV\Exception('Principal not found');
$stmt = $this->pdo->prepare('SELECT principals.uri as uri FROM '.$this->groupMembersTableName.' AS groupmembers LEFT JOIN '.$this->tableName.' AS principals ON groupmembers.principal_id = principals.id WHERE groupmembers.member_id = ?');
- $stmt->execute(array($principal['id']));
+ $stmt->execute([$principal['id']]);
- $result = array();
+ $result = [];
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
$result[] = $row['uri'];
}
@@ -349,13 +349,13 @@ class PDO extends AbstractBackend {
* @param array $members
* @return void
*/
- public function setGroupMemberSet($principal, array $members) {
+ function setGroupMemberSet($principal, array $members) {
// Grabbing the list of principal id's.
$stmt = $this->pdo->prepare('SELECT id, uri FROM '.$this->tableName.' WHERE uri IN (? ' . str_repeat(', ? ', count($members)) . ');');
- $stmt->execute(array_merge(array($principal), $members));
+ $stmt->execute(array_merge([$principal], $members));
- $memberIds = array();
+ $memberIds = [];
$principalId = null;
while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
@@ -369,12 +369,12 @@ class PDO extends AbstractBackend {
// Wiping out old members
$stmt = $this->pdo->prepare('DELETE FROM '.$this->groupMembersTableName.' WHERE principal_id = ?;');
- $stmt->execute(array($principalId));
+ $stmt->execute([$principalId]);
foreach($memberIds as $memberId) {
$stmt = $this->pdo->prepare('INSERT INTO '.$this->groupMembersTableName.' (principal_id, member_id) VALUES (?, ?);');
- $stmt->execute(array($principalId, $memberId));
+ $stmt->execute([$principalId, $memberId]);
}
diff --git a/lib/DAVACL/PrincipalCollection.php b/lib/DAVACL/PrincipalCollection.php
index 3aadf39..b1c7a68 100644
--- a/lib/DAVACL/PrincipalCollection.php
+++ b/lib/DAVACL/PrincipalCollection.php
@@ -24,7 +24,7 @@ class PrincipalCollection extends AbstractPrincipalCollection {
* @param array $principal
* @return \Sabre\DAV\INode
*/
- public function getChildForPrincipal(array $principal) {
+ function getChildForPrincipal(array $principal) {
return new Principal($this->principalBackend, $principal);
diff --git a/lib/DAVACL/Property/Acl.php b/lib/DAVACL/Property/Acl.php
index 949fe3f..4d01c9a 100644
--- a/lib/DAVACL/Property/Acl.php
+++ b/lib/DAVACL/Property/Acl.php
@@ -90,7 +90,7 @@ class Acl extends DAV\Property {
*/
static public function unserialize(\DOMElement $dom, array $propertyMap) {
- $privileges = array();
+ $privileges = [];
$xaces = $dom->getElementsByTagNameNS('urn:DAV','ace');
for($ii=0; $ii < $xaces->length; $ii++) {
@@ -148,11 +148,11 @@ class Acl extends DAV\Property {
throw new DAV\Exception\BadRequest('{DAV:}privilege elements must have a privilege element contained within them.');
}
- $privileges[] = array(
+ $privileges[] = [
'principal' => $principal,
'protected' => $protected,
'privilege' => $privilegeName,
- );
+ ];
}
diff --git a/lib/DAVACL/Property/CurrentUserPrivilegeSet.php b/lib/DAVACL/Property/CurrentUserPrivilegeSet.php
index 0d0517f..d86108a 100644
--- a/lib/DAVACL/Property/CurrentUserPrivilegeSet.php
+++ b/lib/DAVACL/Property/CurrentUserPrivilegeSet.php
@@ -30,7 +30,7 @@ class CurrentUserPrivilegeSet extends DAV\Property {
*
* @param array $privileges
*/
- public function __construct(array $privileges) {
+ function __construct(array $privileges) {
$this->privileges = $privileges;
@@ -43,7 +43,7 @@ class CurrentUserPrivilegeSet extends DAV\Property {
* @param \DOMElement $node
* @return void
*/
- public function serialize(DAV\Server $server,\DOMElement $node) {
+ function serialize(DAV\Server $server,\DOMElement $node) {
$doc = $node->ownerDocument;
foreach($this->privileges as $privName) {
@@ -60,7 +60,7 @@ class CurrentUserPrivilegeSet extends DAV\Property {
*
* @return bool
*/
- public function has($privilegeName) {
+ function has($privilegeName) {
return in_array($privilegeName, $this->privileges);
@@ -71,7 +71,7 @@ class CurrentUserPrivilegeSet extends DAV\Property {
*
* @return array
*/
- public function getValue() {
+ function getValue() {
return $this->privileges;
@@ -104,9 +104,9 @@ class CurrentUserPrivilegeSet extends DAV\Property {
* @param array $propertyMap
* @return CurrentUserPrivilegeSet
*/
- static public function unserialize(\DOMElement $node, array $propertyMap) {
+ static function unserialize(\DOMElement $node, array $propertyMap) {
- $result = array();
+ $result = [];
$xprivs = $node->getElementsByTagNameNS('urn:DAV','privilege');
diff --git a/lib/DAVACL/Property/Principal.php b/lib/DAVACL/Property/Principal.php
index f26a38e..bca11ac 100644
--- a/lib/DAVACL/Property/Principal.php
+++ b/lib/DAVACL/Property/Principal.php
@@ -63,7 +63,7 @@ class Principal extends DAV\Property implements DAV\Property\IHref {
* @param int $type
* @param string|null $href
*/
- public function __construct($type, $href = null) {
+ function __construct($type, $href = null) {
$this->type = $type;
@@ -79,7 +79,7 @@ class Principal extends DAV\Property implements DAV\Property\IHref {
*
* @return int
*/
- public function getType() {
+ function getType() {
return $this->type;
@@ -90,7 +90,7 @@ class Principal extends DAV\Property implements DAV\Property\IHref {
*
* @return string
*/
- public function getHref() {
+ function getHref() {
return $this->href;
@@ -103,7 +103,7 @@ class Principal extends DAV\Property implements DAV\Property\IHref {
* @param \DOMElement $node
* @return void
*/
- public function serialize(DAV\Server $server, \DOMElement $node) {
+ function serialize(DAV\Server $server, \DOMElement $node) {
$prefix = $server->xmlNamespaces['DAV:'];
switch($this->type) {
@@ -135,7 +135,7 @@ class Principal extends DAV\Property implements DAV\Property\IHref {
* @param array $propertyMap
* @return Principal
*/
- static public function unserialize(\DOMElement $dom, array $propertyMap) {
+ static function unserialize(\DOMElement $dom, array $propertyMap) {
$parent = $dom->firstChild;
while(!DAV\XMLUtil::toClarkNotation($parent)) {
diff --git a/lib/DAVACL/Property/SupportedPrivilegeSet.php b/lib/DAVACL/Property/SupportedPrivilegeSet.php
index 0cc8145..c14b23f 100644
--- a/lib/DAVACL/Property/SupportedPrivilegeSet.php
+++ b/lib/DAVACL/Property/SupportedPrivilegeSet.php
@@ -32,7 +32,7 @@ class SupportedPrivilegeSet extends DAV\Property {
*
* @param array $privileges
*/
- public function __construct(array $privileges) {
+ function __construct(array $privileges) {
$this->privileges = $privileges;
@@ -43,7 +43,7 @@ class SupportedPrivilegeSet extends DAV\Property {
*
* @return array
*/
- public function getValue() {
+ function getValue() {
return $this->privileges;
@@ -56,7 +56,7 @@ class SupportedPrivilegeSet extends DAV\Property {
* @param \DOMElement $node
* @return void
*/
- public function serialize(DAV\Server $server,\DOMElement $node) {
+ function serialize(DAV\Server $server,\DOMElement $node) {
$doc = $node->ownerDocument;
$this->serializePriv($doc, $node, $this->privileges);
--
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