[Pkg-owncloud-commits] [php-sabredav] 176/275: New coding standards.
David Prévot
taffit at moszumanska.debian.org
Thu Sep 25 14:56:05 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 2173b83d0dbe2f35396449a8b32a3c39f78ba098
Author: Evert Pot <me at evertpot.com>
Date: Fri Aug 22 18:42:26 2014 -0400
New coding standards.
---
lib/CardDAV/AddressBook.php | 40 ++++++++++++++--------------
lib/CardDAV/AddressBookQueryParser.php | 24 ++++++++---------
lib/CardDAV/AddressBookRoot.php | 6 ++---
lib/CardDAV/Backend/AbstractBackend.php | 2 +-
lib/CardDAV/Backend/BackendInterface.php | 20 +++++++-------
lib/CardDAV/Backend/PDO.php | 42 ++++++++++++++---------------
lib/CardDAV/Backend/SyncSupport.php | 2 +-
lib/CardDAV/Card.php | 40 ++++++++++++++--------------
lib/CardDAV/IAddressBook.php | 2 --
lib/CardDAV/IDirectory.php | 1 -
lib/CardDAV/UserAddressBooks.php | 45 ++++++++++++++++----------------
lib/CardDAV/VCFExportPlugin.php | 10 +++----
12 files changed, 115 insertions(+), 119 deletions(-)
diff --git a/lib/CardDAV/AddressBook.php b/lib/CardDAV/AddressBook.php
index 05e8b41..f9f6a37 100644
--- a/lib/CardDAV/AddressBook.php
+++ b/lib/CardDAV/AddressBook.php
@@ -36,7 +36,7 @@ class AddressBook extends DAV\Collection implements IAddressBook, DAV\IPropertie
* @param Backend\BackendInterface $carddavBackend
* @param array $addressBookInfo
*/
- public function __construct(Backend\BackendInterface $carddavBackend, array $addressBookInfo) {
+ function __construct(Backend\BackendInterface $carddavBackend, array $addressBookInfo) {
$this->carddavBackend = $carddavBackend;
$this->addressBookInfo = $addressBookInfo;
@@ -48,7 +48,7 @@ class AddressBook extends DAV\Collection implements IAddressBook, DAV\IPropertie
*
* @return string
*/
- public function getName() {
+ function getName() {
return $this->addressBookInfo['uri'];
@@ -60,7 +60,7 @@ class AddressBook extends DAV\Collection implements IAddressBook, DAV\IPropertie
* @param string $name
* @return \ICard
*/
- public function getChild($name) {
+ function getChild($name) {
$obj = $this->carddavBackend->getCard($this->addressBookInfo['id'],$name);
if (!$obj) throw new DAV\Exception\NotFound('Card not found');
@@ -73,7 +73,7 @@ class AddressBook extends DAV\Collection implements IAddressBook, DAV\IPropertie
*
* @return array
*/
- public function getChildren() {
+ function getChildren() {
$objs = $this->carddavBackend->getCards($this->addressBookInfo['id']);
$children = [];
@@ -93,7 +93,7 @@ class AddressBook extends DAV\Collection implements IAddressBook, DAV\IPropertie
*
* @return array
*/
- public function getMultipleChildren(array $paths) {
+ function getMultipleChildren(array $paths) {
$objs = $this->carddavBackend->getMultipleCards($this->addressBookInfo['id'], $paths);
$children = [];
@@ -113,7 +113,7 @@ class AddressBook extends DAV\Collection implements IAddressBook, DAV\IPropertie
* @param string $name
* @return void
*/
- public function createDirectory($name) {
+ function createDirectory($name) {
throw new DAV\Exception\MethodNotAllowed('Creating collections in addressbooks is not allowed');
@@ -130,7 +130,7 @@ class AddressBook extends DAV\Collection implements IAddressBook, DAV\IPropertie
* @param resource $vcardData
* @return string|null
*/
- public function createFile($name,$vcardData = null) {
+ function createFile($name,$vcardData = null) {
if (is_resource($vcardData)) {
$vcardData = stream_get_contents($vcardData);
@@ -147,7 +147,7 @@ class AddressBook extends DAV\Collection implements IAddressBook, DAV\IPropertie
*
* @return void
*/
- public function delete() {
+ function delete() {
$this->carddavBackend->deleteAddressBook($this->addressBookInfo['id']);
@@ -159,7 +159,7 @@ class AddressBook extends DAV\Collection implements IAddressBook, DAV\IPropertie
* @param string $newName
* @return void
*/
- public function setName($newName) {
+ function setName($newName) {
throw new DAV\Exception\MethodNotAllowed('Renaming addressbooks is not yet supported');
@@ -170,7 +170,7 @@ class AddressBook extends DAV\Collection implements IAddressBook, DAV\IPropertie
*
* @return void
*/
- public function getLastModified() {
+ function getLastModified() {
return null;
@@ -188,7 +188,7 @@ class AddressBook extends DAV\Collection implements IAddressBook, DAV\IPropertie
* @param DAV\PropPatch $propPatch
* @return void
*/
- public function propPatch(DAV\PropPatch $propPatch) {
+ function propPatch(DAV\PropPatch $propPatch) {
return $this->carddavBackend->updateAddressBook($this->addressBookInfo['id'], $propPatch);
@@ -205,7 +205,7 @@ class AddressBook extends DAV\Collection implements IAddressBook, DAV\IPropertie
* @param array $properties
* @return array
*/
- public function getProperties($properties) {
+ function getProperties($properties) {
$response = [];
foreach($properties as $propertyName) {
@@ -229,7 +229,7 @@ class AddressBook extends DAV\Collection implements IAddressBook, DAV\IPropertie
*
* @return string|null
*/
- public function getOwner() {
+ function getOwner() {
return $this->addressBookInfo['principaluri'];
@@ -242,7 +242,7 @@ class AddressBook extends DAV\Collection implements IAddressBook, DAV\IPropertie
*
* @return string|null
*/
- public function getGroup() {
+ function getGroup() {
return null;
@@ -260,7 +260,7 @@ class AddressBook extends DAV\Collection implements IAddressBook, DAV\IPropertie
*
* @return array
*/
- public function getACL() {
+ function getACL() {
return [
[
@@ -285,7 +285,7 @@ class AddressBook extends DAV\Collection implements IAddressBook, DAV\IPropertie
*
* @return array
*/
- public function getChildACL() {
+ function getChildACL() {
return [
[
@@ -310,7 +310,7 @@ class AddressBook extends DAV\Collection implements IAddressBook, DAV\IPropertie
* @param array $acl
* @return void
*/
- public function setACL(array $acl) {
+ function setACL(array $acl) {
throw new DAV\Exception\MethodNotAllowed('Changing ACL is not yet supported');
@@ -328,7 +328,7 @@ class AddressBook extends DAV\Collection implements IAddressBook, DAV\IPropertie
*
* @return array|null
*/
- public function getSupportedPrivilegeSet() {
+ function getSupportedPrivilegeSet() {
return null;
@@ -343,7 +343,7 @@ class AddressBook extends DAV\Collection implements IAddressBook, DAV\IPropertie
*
* @return string|null
*/
- public function getSyncToken() {
+ function getSyncToken() {
if (
$this->carddavBackend instanceof Backend\SyncSupport &&
@@ -409,7 +409,7 @@ class AddressBook extends DAV\Collection implements IAddressBook, DAV\IPropertie
* @param int $limit
* @return array
*/
- public function getChanges($syncToken, $syncLevel, $limit = null) {
+ function getChanges($syncToken, $syncLevel, $limit = null) {
if (!$this->carddavBackend instanceof Backend\SyncSupport) {
return null;
diff --git a/lib/CardDAV/AddressBookQueryParser.php b/lib/CardDAV/AddressBookQueryParser.php
index 21d652d..500591f 100644
--- a/lib/CardDAV/AddressBookQueryParser.php
+++ b/lib/CardDAV/AddressBookQueryParser.php
@@ -68,7 +68,7 @@ class AddressBookQueryParser {
*
* @param \DOMDocument $dom
*/
- public function __construct(\DOMDocument $dom) {
+ function __construct(\DOMDocument $dom) {
$this->dom = $dom;
@@ -82,7 +82,7 @@ class AddressBookQueryParser {
*
* @return void
*/
- public function parse() {
+ function parse() {
$filterNode = null;
@@ -111,7 +111,7 @@ class AddressBookQueryParser {
throw new DAV\Exception\BadRequest('The test attribute must either hold "anyof" or "allof"');
}
- $propFilters = array();
+ $propFilters = [];
if (!is_null($filter)) {
$propFilterNodes = $this->xpath->query('card:prop-filter', $filter);
@@ -138,7 +138,7 @@ class AddressBookQueryParser {
*/
protected function parsePropFilterNode(\DOMElement $propFilterNode) {
- $propFilter = array();
+ $propFilter = [];
$propFilter['name'] = $propFilterNode->getAttribute('name');
$propFilter['test'] = $propFilterNode->getAttribute('test');
if (!$propFilter['test']) $propFilter['test'] = 'anyof';
@@ -147,7 +147,7 @@ class AddressBookQueryParser {
$paramFilterNodes = $this->xpath->query('card:param-filter', $propFilterNode);
- $propFilter['param-filters'] = array();
+ $propFilter['param-filters'] = [];
for($ii=0;$ii<$paramFilterNodes->length;$ii++) {
@@ -155,7 +155,7 @@ class AddressBookQueryParser {
$propFilter['param-filters'][] = $this->parseParamFilterNode($paramFilterNodes->item($ii));
}
- $propFilter['text-matches'] = array();
+ $propFilter['text-matches'] = [];
$textMatchNodes = $this->xpath->query('card:text-match', $propFilterNode);
for($ii=0;$ii<$textMatchNodes->length;$ii++) {
@@ -174,9 +174,9 @@ class AddressBookQueryParser {
* @param \DOMElement $paramFilterNode
* @return array
*/
- public function parseParamFilterNode(\DOMElement $paramFilterNode) {
+ function parseParamFilterNode(\DOMElement $paramFilterNode) {
- $paramFilter = array();
+ $paramFilter = [];
$paramFilter['name'] = $paramFilterNode->getAttribute('name');
$paramFilter['is-not-defined'] = $this->xpath->query('card:is-not-defined', $paramFilterNode)->length>0;
$paramFilter['text-match'] = null;
@@ -196,12 +196,12 @@ class AddressBookQueryParser {
* @param \DOMElement $textMatchNode
* @return array
*/
- public function parseTextMatchNode(\DOMElement $textMatchNode) {
+ function parseTextMatchNode(\DOMElement $textMatchNode) {
$matchType = $textMatchNode->getAttribute('match-type');
if (!$matchType) $matchType = 'contains';
- if (!in_array($matchType, array('contains', 'equals', 'starts-with', 'ends-with'))) {
+ if (!in_array($matchType, ['contains', 'equals', 'starts-with', 'ends-with'])) {
throw new DAV\Exception\BadRequest('Unknown match-type: ' . $matchType);
}
@@ -210,12 +210,12 @@ class AddressBookQueryParser {
$collation = $textMatchNode->getAttribute('collation');
if (!$collation) $collation = 'i;unicode-casemap';
- return array(
+ return [
'negate-condition' => $negateCondition,
'collation' => $collation,
'match-type' => $matchType,
'value' => $textMatchNode->nodeValue
- );
+ ];
}
diff --git a/lib/CardDAV/AddressBookRoot.php b/lib/CardDAV/AddressBookRoot.php
index 789abbc..5c5b108 100644
--- a/lib/CardDAV/AddressBookRoot.php
+++ b/lib/CardDAV/AddressBookRoot.php
@@ -43,7 +43,7 @@ class AddressBookRoot extends DAVACL\AbstractPrincipalCollection {
* @param Backend\BackendInterface $carddavBackend
* @param string $principalPrefix
*/
- public function __construct(DAVACL\PrincipalBackend\BackendInterface $principalBackend,Backend\BackendInterface $carddavBackend, $principalPrefix = 'principals') {
+ function __construct(DAVACL\PrincipalBackend\BackendInterface $principalBackend,Backend\BackendInterface $carddavBackend, $principalPrefix = 'principals') {
$this->carddavBackend = $carddavBackend;
parent::__construct($principalBackend, $principalPrefix);
@@ -55,7 +55,7 @@ class AddressBookRoot extends DAVACL\AbstractPrincipalCollection {
*
* @return string
*/
- public function getName() {
+ function getName() {
return Plugin::ADDRESSBOOK_ROOT;
@@ -71,7 +71,7 @@ class AddressBookRoot extends DAVACL\AbstractPrincipalCollection {
* @param array $principal
* @return \Sabre\DAV\INode
*/
- public function getChildForPrincipal(array $principal) {
+ function getChildForPrincipal(array $principal) {
return new UserAddressBooks($this->carddavBackend, $principal['uri']);
diff --git a/lib/CardDAV/Backend/AbstractBackend.php b/lib/CardDAV/Backend/AbstractBackend.php
index 15600e7..cf79080 100644
--- a/lib/CardDAV/Backend/AbstractBackend.php
+++ b/lib/CardDAV/Backend/AbstractBackend.php
@@ -27,7 +27,7 @@ abstract class AbstractBackend implements BackendInterface {
* @param array $uris
* @return array
*/
- public function getMultipleCards($addressBookId, array $uris) {
+ function getMultipleCards($addressBookId, array $uris) {
return array_map(function($uri) use ($addressBookId) {
return $this->getCard($addressBookId, $uri);
diff --git a/lib/CardDAV/Backend/BackendInterface.php b/lib/CardDAV/Backend/BackendInterface.php
index 0045155..5618c69 100644
--- a/lib/CardDAV/Backend/BackendInterface.php
+++ b/lib/CardDAV/Backend/BackendInterface.php
@@ -34,7 +34,7 @@ interface BackendInterface {
* @param string $principalUri
* @return array
*/
- public function getAddressBooksForUser($principalUri);
+ function getAddressBooksForUser($principalUri);
/**
* Updates properties for an address book.
@@ -52,7 +52,7 @@ interface BackendInterface {
* @param \Sabre\DAV\PropPatch $propPatch
* @return void
*/
- public function updateAddressBook($addressBookId, \Sabre\DAV\PropPatch $propPatch);
+ function updateAddressBook($addressBookId, \Sabre\DAV\PropPatch $propPatch);
/**
* Creates a new address book
@@ -62,7 +62,7 @@ interface BackendInterface {
* @param array $properties
* @return void
*/
- public function createAddressBook($principalUri, $url, array $properties);
+ function createAddressBook($principalUri, $url, array $properties);
/**
* Deletes an entire addressbook and all its contents
@@ -70,7 +70,7 @@ interface BackendInterface {
* @param mixed $addressBookId
* @return void
*/
- public function deleteAddressBook($addressBookId);
+ function deleteAddressBook($addressBookId);
/**
* Returns all cards for a specific addressbook id.
@@ -91,7 +91,7 @@ interface BackendInterface {
* @param mixed $addressbookId
* @return array
*/
- public function getCards($addressbookId);
+ function getCards($addressbookId);
/**
* Returns a specfic card.
@@ -105,7 +105,7 @@ interface BackendInterface {
* @param string $cardUri
* @return array
*/
- public function getCard($addressBookId, $cardUri);
+ function getCard($addressBookId, $cardUri);
/**
* Returns a list of cards.
@@ -119,7 +119,7 @@ interface BackendInterface {
* @param array $uris
* @return array
*/
- public function getMultipleCards($addressBookId, array $uris);
+ function getMultipleCards($addressBookId, array $uris);
/**
* Creates a new card.
@@ -146,7 +146,7 @@ interface BackendInterface {
* @param string $cardData
* @return string|null
*/
- public function createCard($addressBookId, $cardUri, $cardData);
+ function createCard($addressBookId, $cardUri, $cardData);
/**
* Updates a card.
@@ -173,7 +173,7 @@ interface BackendInterface {
* @param string $cardData
* @return string|null
*/
- public function updateCard($addressBookId, $cardUri, $cardData);
+ function updateCard($addressBookId, $cardUri, $cardData);
/**
* Deletes a card
@@ -182,6 +182,6 @@ interface BackendInterface {
* @param string $cardUri
* @return bool
*/
- public function deleteCard($addressBookId, $cardUri);
+ function deleteCard($addressBookId, $cardUri);
}
diff --git a/lib/CardDAV/Backend/PDO.php b/lib/CardDAV/Backend/PDO.php
index ddba0e0..a40598a 100644
--- a/lib/CardDAV/Backend/PDO.php
+++ b/lib/CardDAV/Backend/PDO.php
@@ -47,7 +47,7 @@ class PDO extends AbstractBackend implements SyncSupport {
* @param string $addressBooksTableName
* @param string $cardsTableName
*/
- public function __construct(\PDO $pdo, $addressBooksTableName = 'addressbooks', $cardsTableName = 'cards', $addressBookChangesTableName = 'addressbookchanges') {
+ function __construct(\PDO $pdo, $addressBooksTableName = 'addressbooks', $cardsTableName = 'cards', $addressBookChangesTableName = 'addressbookchanges') {
$this->pdo = $pdo;
$this->addressBooksTableName = $addressBooksTableName;
@@ -62,16 +62,16 @@ class PDO extends AbstractBackend implements SyncSupport {
* @param string $principalUri
* @return array
*/
- public function getAddressBooksForUser($principalUri) {
+ function getAddressBooksForUser($principalUri) {
$stmt = $this->pdo->prepare('SELECT id, uri, displayname, principaluri, description, synctoken FROM '.$this->addressBooksTableName.' WHERE principaluri = ?');
- $stmt->execute(array($principalUri));
+ $stmt->execute([$principalUri]);
- $addressBooks = array();
+ $addressBooks = [];
foreach($stmt->fetchAll() as $row) {
- $addressBooks[] = array(
+ $addressBooks[] = [
'id' => $row['id'],
'uri' => $row['uri'],
'principaluri' => $row['principaluri'],
@@ -79,7 +79,7 @@ class PDO extends AbstractBackend implements SyncSupport {
'{' . CardDAV\Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'],
'{http://calendarserver.org/ns/}getctag' => $row['synctoken'],
'{DAV:}sync-token' => $row['synctoken']?$row['synctoken']:'0',
- );
+ ];
}
@@ -104,7 +104,7 @@ class PDO extends AbstractBackend implements SyncSupport {
* @param \Sabre\DAV\PropPatch $propPatch
* @return void
*/
- public function updateAddressBook($addressBookId, \Sabre\DAV\PropPatch $propPatch) {
+ function updateAddressBook($addressBookId, \Sabre\DAV\PropPatch $propPatch) {
$supportedProperties = [
'{DAV:}displayname',
@@ -158,14 +158,14 @@ class PDO extends AbstractBackend implements SyncSupport {
* @param array $properties
* @return void
*/
- public function createAddressBook($principalUri, $url, array $properties) {
+ function createAddressBook($principalUri, $url, array $properties) {
- $values = array(
+ $values = [
'displayname' => null,
'description' => null,
'principaluri' => $principalUri,
'uri' => $url,
- );
+ ];
foreach($properties as $property=>$newValue) {
@@ -195,7 +195,7 @@ class PDO extends AbstractBackend implements SyncSupport {
* @param int $addressBookId
* @return void
*/
- public function deleteAddressBook($addressBookId) {
+ function deleteAddressBook($addressBookId) {
$stmt = $this->pdo->prepare('DELETE FROM ' . $this->cardsTableName . ' WHERE addressbookid = ?');
$stmt->execute([$addressBookId]);
@@ -227,10 +227,10 @@ class PDO extends AbstractBackend implements SyncSupport {
* @param mixed $addressbookId
* @return array
*/
- public function getCards($addressbookId) {
+ function getCards($addressbookId) {
$stmt = $this->pdo->prepare('SELECT id, uri, lastmodified, etag, size FROM ' . $this->cardsTableName . ' WHERE addressbookid = ?');
- $stmt->execute(array($addressbookId));
+ $stmt->execute([$addressbookId]);
$result = [];
while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
@@ -253,10 +253,10 @@ class PDO extends AbstractBackend implements SyncSupport {
* @param string $cardUri
* @return array
*/
- public function getCard($addressBookId, $cardUri) {
+ function getCard($addressBookId, $cardUri) {
$stmt = $this->pdo->prepare('SELECT id, carddata, uri, lastmodified, etag, size FROM ' . $this->cardsTableName . ' WHERE addressbookid = ? AND uri = ? LIMIT 1');
- $stmt->execute(array($addressBookId, $cardUri));
+ $stmt->execute([$addressBookId, $cardUri]);
$result = $stmt->fetch(\PDO::FETCH_ASSOC);
@@ -279,7 +279,7 @@ class PDO extends AbstractBackend implements SyncSupport {
* @param array $uris
* @return array
*/
- public function getMultipleCards($addressBookId, array $uris) {
+ function getMultipleCards($addressBookId, array $uris) {
return array_map(function($uri) use ($addressBookId) {
return $this->getCard($addressBookId, $uri);
@@ -326,7 +326,7 @@ class PDO extends AbstractBackend implements SyncSupport {
* @param string $cardData
* @return string|null
*/
- public function createCard($addressBookId, $cardUri, $cardData) {
+ function createCard($addressBookId, $cardUri, $cardData) {
$stmt = $this->pdo->prepare('INSERT INTO ' . $this->cardsTableName . ' (carddata, uri, lastmodified, addressbookid, size, etag) VALUES (?, ?, ?, ?, ?, ?)');
@@ -372,7 +372,7 @@ class PDO extends AbstractBackend implements SyncSupport {
* @param string $cardData
* @return string|null
*/
- public function updateCard($addressBookId, $cardUri, $cardData) {
+ function updateCard($addressBookId, $cardUri, $cardData) {
$stmt = $this->pdo->prepare('UPDATE ' . $this->cardsTableName . ' SET carddata = ?, lastmodified = ?, size = ?, etag = ? WHERE uri = ? AND addressbookid =?');
@@ -399,10 +399,10 @@ class PDO extends AbstractBackend implements SyncSupport {
* @param string $cardUri
* @return bool
*/
- public function deleteCard($addressBookId, $cardUri) {
+ function deleteCard($addressBookId, $cardUri) {
$stmt = $this->pdo->prepare('DELETE FROM ' . $this->cardsTableName . ' WHERE addressbookid = ? AND uri = ?');
- $stmt->execute(array($addressBookId, $cardUri));
+ $stmt->execute([$addressBookId, $cardUri]);
$this->addChange($addressBookId, $cardUri, 3);
@@ -466,7 +466,7 @@ class PDO extends AbstractBackend implements SyncSupport {
* @param int $limit
* @return array
*/
- public function getChangesForAddressBook($addressBookId, $syncToken, $syncLevel, $limit = null) {
+ function getChangesForAddressBook($addressBookId, $syncToken, $syncLevel, $limit = null) {
// Current synctoken
$stmt = $this->pdo->prepare('SELECT synctoken FROM ' . $this->addressBooksTableName . ' WHERE id = ?');
diff --git a/lib/CardDAV/Backend/SyncSupport.php b/lib/CardDAV/Backend/SyncSupport.php
index 85deecd..5d76f80 100644
--- a/lib/CardDAV/Backend/SyncSupport.php
+++ b/lib/CardDAV/Backend/SyncSupport.php
@@ -76,6 +76,6 @@ interface SyncSupport extends BackendInterface {
* @param int $limit
* @return array
*/
- public function getChangesForAddressBook($addressBookId, $syncToken, $syncLevel, $limit = null);
+ function getChangesForAddressBook($addressBookId, $syncToken, $syncLevel, $limit = null);
}
diff --git a/lib/CardDAV/Card.php b/lib/CardDAV/Card.php
index 6af9dda..667b08c 100644
--- a/lib/CardDAV/Card.php
+++ b/lib/CardDAV/Card.php
@@ -43,7 +43,7 @@ class Card extends DAV\File implements ICard, DAVACL\IACL {
* @param array $addressBookInfo
* @param array $cardData
*/
- public function __construct(Backend\BackendInterface $carddavBackend,array $addressBookInfo,array $cardData) {
+ function __construct(Backend\BackendInterface $carddavBackend,array $addressBookInfo,array $cardData) {
$this->carddavBackend = $carddavBackend;
$this->addressBookInfo = $addressBookInfo;
@@ -56,7 +56,7 @@ class Card extends DAV\File implements ICard, DAVACL\IACL {
*
* @return string
*/
- public function getName() {
+ function getName() {
return $this->cardData['uri'];
@@ -67,7 +67,7 @@ class Card extends DAV\File implements ICard, DAVACL\IACL {
*
* @return string
*/
- public function get() {
+ function get() {
// Pre-populating 'carddata' is optional. If we don't yet have it
// already, we fetch it from the backend.
@@ -84,7 +84,7 @@ class Card extends DAV\File implements ICard, DAVACL\IACL {
* @param string $cardData
* @return string|null
*/
- public function put($cardData) {
+ function put($cardData) {
if (is_resource($cardData))
$cardData = stream_get_contents($cardData);
@@ -105,7 +105,7 @@ class Card extends DAV\File implements ICard, DAVACL\IACL {
*
* @return void
*/
- public function delete() {
+ function delete() {
$this->carddavBackend->deleteCard($this->addressBookInfo['id'],$this->cardData['uri']);
@@ -116,7 +116,7 @@ class Card extends DAV\File implements ICard, DAVACL\IACL {
*
* @return string
*/
- public function getContentType() {
+ function getContentType() {
return 'text/vcard; charset=utf-8';
@@ -127,7 +127,7 @@ class Card extends DAV\File implements ICard, DAVACL\IACL {
*
* @return string
*/
- public function getETag() {
+ function getETag() {
if (isset($this->cardData['etag'])) {
return $this->cardData['etag'];
@@ -148,7 +148,7 @@ class Card extends DAV\File implements ICard, DAVACL\IACL {
*
* @return int
*/
- public function getLastModified() {
+ function getLastModified() {
return isset($this->cardData['lastmodified'])?$this->cardData['lastmodified']:null;
@@ -159,7 +159,7 @@ class Card extends DAV\File implements ICard, DAVACL\IACL {
*
* @return int
*/
- public function getSize() {
+ function getSize() {
if (array_key_exists('size', $this->cardData)) {
return $this->cardData['size'];
@@ -176,7 +176,7 @@ class Card extends DAV\File implements ICard, DAVACL\IACL {
*
* @return string|null
*/
- public function getOwner() {
+ function getOwner() {
return $this->addressBookInfo['principaluri'];
@@ -189,7 +189,7 @@ class Card extends DAV\File implements ICard, DAVACL\IACL {
*
* @return string|null
*/
- public function getGroup() {
+ function getGroup() {
return null;
@@ -207,25 +207,25 @@ class Card extends DAV\File implements ICard, DAVACL\IACL {
*
* @return array
*/
- public function getACL() {
+ function getACL() {
// An alternative acl may be specified through the cardData array.
if (isset($this->cardData['acl'])) {
return $this->cardData['acl'];
}
- return array(
- array(
+ return [
+ [
'privilege' => '{DAV:}read',
'principal' => $this->addressBookInfo['principaluri'],
'protected' => true,
- ),
- array(
+ ],
+ [
'privilege' => '{DAV:}write',
'principal' => $this->addressBookInfo['principaluri'],
'protected' => true,
- ),
- );
+ ],
+ ];
}
@@ -237,7 +237,7 @@ class Card extends DAV\File implements ICard, DAVACL\IACL {
* @param array $acl
* @return void
*/
- public function setACL(array $acl) {
+ function setACL(array $acl) {
throw new DAV\Exception\MethodNotAllowed('Changing ACL is not yet supported');
@@ -255,7 +255,7 @@ class Card extends DAV\File implements ICard, DAVACL\IACL {
*
* @return array|null
*/
- public function getSupportedPrivilegeSet() {
+ function getSupportedPrivilegeSet() {
return null;
diff --git a/lib/CardDAV/IAddressBook.php b/lib/CardDAV/IAddressBook.php
index e9e990c..77a859b 100644
--- a/lib/CardDAV/IAddressBook.php
+++ b/lib/CardDAV/IAddressBook.php
@@ -15,6 +15,4 @@ use Sabre\DAV;
*/
interface IAddressBook extends DAV\ICollection {
-
-
}
diff --git a/lib/CardDAV/IDirectory.php b/lib/CardDAV/IDirectory.php
index c2774cb..7c23501 100644
--- a/lib/CardDAV/IDirectory.php
+++ b/lib/CardDAV/IDirectory.php
@@ -17,5 +17,4 @@ namespace Sabre\CardDAV;
*/
interface IDirectory extends IAddressBook {
-
}
diff --git a/lib/CardDAV/UserAddressBooks.php b/lib/CardDAV/UserAddressBooks.php
index 74c1359..46af63a 100644
--- a/lib/CardDAV/UserAddressBooks.php
+++ b/lib/CardDAV/UserAddressBooks.php
@@ -38,7 +38,7 @@ class UserAddressBooks extends DAV\Collection implements DAV\IExtendedCollection
* @param Backend\BackendInterface $carddavBackend
* @param string $principalUri
*/
- public function __construct(Backend\BackendInterface $carddavBackend, $principalUri) {
+ function __construct(Backend\BackendInterface $carddavBackend, $principalUri) {
$this->carddavBackend = $carddavBackend;
$this->principalUri = $principalUri;
@@ -50,7 +50,7 @@ class UserAddressBooks extends DAV\Collection implements DAV\IExtendedCollection
*
* @return string
*/
- public function getName() {
+ function getName() {
list(,$name) = URLUtil::splitPath($this->principalUri);
return $name;
@@ -63,7 +63,7 @@ class UserAddressBooks extends DAV\Collection implements DAV\IExtendedCollection
* @param string $name
* @return void
*/
- public function setName($name) {
+ function setName($name) {
throw new DAV\Exception\MethodNotAllowed();
@@ -74,7 +74,7 @@ class UserAddressBooks extends DAV\Collection implements DAV\IExtendedCollection
*
* @return void
*/
- public function delete() {
+ function delete() {
throw new DAV\Exception\MethodNotAllowed();
@@ -85,7 +85,7 @@ class UserAddressBooks extends DAV\Collection implements DAV\IExtendedCollection
*
* @return int
*/
- public function getLastModified() {
+ function getLastModified() {
return null;
@@ -100,7 +100,7 @@ class UserAddressBooks extends DAV\Collection implements DAV\IExtendedCollection
* @param resource $data
* @return void
*/
- public function createFile($filename, $data=null) {
+ function createFile($filename, $data=null) {
throw new DAV\Exception\MethodNotAllowed('Creating new files in this collection is not supported');
@@ -114,7 +114,7 @@ class UserAddressBooks extends DAV\Collection implements DAV\IExtendedCollection
* @param string $filename
* @return void
*/
- public function createDirectory($filename) {
+ function createDirectory($filename) {
throw new DAV\Exception\MethodNotAllowed('Creating new collections in this collection is not supported');
@@ -127,7 +127,7 @@ class UserAddressBooks extends DAV\Collection implements DAV\IExtendedCollection
* @todo needs optimizing
* @return \AddressBook
*/
- public function getChild($name) {
+ function getChild($name) {
foreach($this->getChildren() as $child) {
if ($name==$child->getName())
@@ -143,10 +143,10 @@ class UserAddressBooks extends DAV\Collection implements DAV\IExtendedCollection
*
* @return array
*/
- public function getChildren() {
+ function getChildren() {
$addressbooks = $this->carddavBackend->getAddressBooksForUser($this->principalUri);
- $objs = array();
+ $objs = [];
foreach($addressbooks as $addressbook) {
$objs[] = new AddressBook($this->carddavBackend, $addressbook);
}
@@ -162,7 +162,7 @@ class UserAddressBooks extends DAV\Collection implements DAV\IExtendedCollection
* @param array $properties
* @return void
*/
- public function createExtendedCollection($name, array $resourceType, array $properties) {
+ function createExtendedCollection($name, array $resourceType, array $properties) {
if (!in_array('{'.Plugin::NS_CARDDAV.'}addressbook',$resourceType) || count($resourceType)!==2) {
throw new DAV\Exception\InvalidResourceType('Unknown resourceType for this collection');
@@ -178,7 +178,7 @@ class UserAddressBooks extends DAV\Collection implements DAV\IExtendedCollection
*
* @return string|null
*/
- public function getOwner() {
+ function getOwner() {
return $this->principalUri;
@@ -191,7 +191,7 @@ class UserAddressBooks extends DAV\Collection implements DAV\IExtendedCollection
*
* @return string|null
*/
- public function getGroup() {
+ function getGroup() {
return null;
@@ -209,21 +209,20 @@ class UserAddressBooks extends DAV\Collection implements DAV\IExtendedCollection
*
* @return array
*/
- public function getACL() {
+ function getACL() {
- return array(
- array(
+ return [
+ [
'privilege' => '{DAV:}read',
'principal' => $this->principalUri,
'protected' => true,
- ),
- array(
+ ],
+ [
'privilege' => '{DAV:}write',
'principal' => $this->principalUri,
'protected' => true,
- ),
-
- );
+ ],
+ ];
}
@@ -235,7 +234,7 @@ class UserAddressBooks extends DAV\Collection implements DAV\IExtendedCollection
* @param array $acl
* @return void
*/
- public function setACL(array $acl) {
+ function setACL(array $acl) {
throw new DAV\Exception\MethodNotAllowed('Changing ACL is not yet supported');
@@ -253,7 +252,7 @@ class UserAddressBooks extends DAV\Collection implements DAV\IExtendedCollection
*
* @return array|null
*/
- public function getSupportedPrivilegeSet() {
+ function getSupportedPrivilegeSet() {
return null;
diff --git a/lib/CardDAV/VCFExportPlugin.php b/lib/CardDAV/VCFExportPlugin.php
index dd58707..d7e52ac 100644
--- a/lib/CardDAV/VCFExportPlugin.php
+++ b/lib/CardDAV/VCFExportPlugin.php
@@ -35,7 +35,7 @@ class VCFExportPlugin extends DAV\ServerPlugin {
* @param DAV\Server $server
* @return void
*/
- public function initialize(DAV\Server $server) {
+ function initialize(DAV\Server $server) {
$this->server = $server;
$this->server->on('method:GET', [$this,'httpGet'], 90);
@@ -49,7 +49,7 @@ class VCFExportPlugin extends DAV\ServerPlugin {
* @param ResponseInterface $response
* @return bool
*/
- public function httpGet(RequestInterface $request, ResponseInterface $response) {
+ function httpGet(RequestInterface $request, ResponseInterface $response) {
$queryParams = $request->getQueryParameters();
if (!array_key_exists('export', $queryParams)) return;
@@ -70,9 +70,9 @@ class VCFExportPlugin extends DAV\ServerPlugin {
$response->setHeader('Content-Type','text/directory');
$response->setStatus(200);
- $nodes = $this->server->getPropertiesForPath($path, array(
+ $nodes = $this->server->getPropertiesForPath($path, [
'{' . Plugin::NS_CARDDAV . '}address-data',
- ),1);
+ ],1);
$response->setBody($this->generateVCF($nodes));
@@ -87,7 +87,7 @@ class VCFExportPlugin extends DAV\ServerPlugin {
* @param array $nodes
* @return string
*/
- public function generateVCF(array $nodes) {
+ function generateVCF(array $nodes) {
$output = "";
--
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