[Pkg-owncloud-commits] [php-sabredav] 06/34: Applied cs-fixer
David Prévot
taffit at moszumanska.debian.org
Wed May 27 13:57:06 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to tag 3.0.0-beta1
in repository php-sabredav.
commit cf87d1b7525a9af998803cfce4d9b691c62514d7
Author: Evert Pot <me at evertpot.com>
Date: Tue May 19 21:53:45 2015 +0300
Applied cs-fixer
---
lib/CalDAV/Backend/AbstractBackend.php | 28 +--
lib/CalDAV/Backend/BackendInterface.php | 10 +-
lib/CalDAV/Backend/PDO.php | 153 +++++++-------
lib/CalDAV/Calendar.php | 31 ++-
lib/CalDAV/CalendarHome.php | 25 ++-
lib/CalDAV/CalendarObject.php | 13 +-
lib/CalDAV/CalendarQueryValidator.php | 28 +--
lib/CalDAV/CalendarRoot.php | 2 +-
lib/CalDAV/Exception/InvalidComponentType.php | 2 +-
lib/CalDAV/ICSExportPlugin.php | 49 +++--
lib/CalDAV/ICalendar.php | 1 -
lib/CalDAV/ICalendarObject.php | 1 +
lib/CalDAV/Notifications/Collection.php | 2 +-
lib/CalDAV/Notifications/Node.php | 2 +-
lib/CalDAV/Notifications/Plugin.php | 9 +-
lib/CalDAV/Plugin.php | 101 +++++----
lib/CalDAV/Principal/Collection.php | 1 +
lib/CalDAV/Principal/ProxyRead.php | 1 +
lib/CalDAV/Principal/ProxyWrite.php | 3 +-
lib/CalDAV/Principal/User.php | 3 +-
lib/CalDAV/Schedule/IMipPlugin.php | 11 +-
lib/CalDAV/Schedule/Inbox.php | 19 +-
lib/CalDAV/Schedule/Outbox.php | 1 +
lib/CalDAV/Schedule/Plugin.php | 125 ++++++------
lib/CalDAV/Schedule/SchedulingObject.php | 4 +-
lib/CalDAV/SharedCalendar.php | 2 +-
lib/CalDAV/SharingPlugin.php | 18 +-
lib/CalDAV/Subscriptions/Plugin.php | 13 +-
lib/CalDAV/Subscriptions/Subscription.php | 23 +--
lib/CalDAV/Xml/Filter/CalendarData.php | 15 +-
lib/CalDAV/Xml/Filter/CompFilter.php | 20 +-
lib/CalDAV/Xml/Filter/ParamFilter.php | 13 +-
lib/CalDAV/Xml/Filter/PropFilter.php | 22 +-
lib/CalDAV/Xml/Notification/Invite.php | 18 +-
lib/CalDAV/Xml/Notification/InviteReply.php | 8 +-
lib/CalDAV/Xml/Notification/SystemStatus.php | 15 +-
lib/CalDAV/Xml/Property/EmailAddressSet.php | 2 +-
lib/CalDAV/Xml/Property/Invite.php | 22 +-
lib/CalDAV/Xml/Property/ScheduleCalendarTransp.php | 10 +-
.../Xml/Property/SupportedCalendarComponentSet.php | 6 +-
lib/CalDAV/Xml/Property/SupportedCalendarData.php | 9 +-
lib/CalDAV/Xml/Property/SupportedCollationSet.php | 2 +-
lib/CalDAV/Xml/Request/CalendarMultiGetReport.php | 10 +-
lib/CalDAV/Xml/Request/CalendarQueryReport.php | 14 +-
lib/CalDAV/Xml/Request/FreeBusyQueryReport.php | 8 +-
lib/CalDAV/Xml/Request/InviteReply.php | 19 +-
lib/CalDAV/Xml/Request/MkCalendar.php | 2 +-
lib/CalDAV/Xml/Request/Share.php | 16 +-
lib/CardDAV/AddressBook.php | 18 +-
lib/CardDAV/AddressBookHome.php | 21 +-
lib/CardDAV/AddressBookRoot.php | 2 +-
lib/CardDAV/Backend/PDO.php | 60 +++---
lib/CardDAV/Card.php | 10 +-
lib/CardDAV/ICard.php | 1 -
lib/CardDAV/Plugin.php | 96 +++++----
lib/CardDAV/VCFExportPlugin.php | 17 +-
lib/CardDAV/Xml/Filter/AddressData.php | 10 +-
lib/CardDAV/Xml/Filter/ParamFilter.php | 14 +-
lib/CardDAV/Xml/Filter/PropFilter.php | 25 ++-
lib/CardDAV/Xml/Property/SupportedAddressData.php | 4 +-
lib/CardDAV/Xml/Property/SupportedCollationSet.php | 2 +-
.../Xml/Request/AddressBookMultiGetReport.php | 10 +-
lib/CardDAV/Xml/Request/AddressBookQueryReport.php | 36 ++--
lib/DAV/Auth/Backend/AbstractBasic.php | 12 +-
lib/DAV/Auth/Backend/AbstractDigest.php | 11 +-
lib/DAV/Auth/Backend/Apache.php | 7 +-
lib/DAV/Auth/Backend/BackendInterface.php | 6 +-
lib/DAV/Auth/Backend/BasicCallBack.php | 5 +-
lib/DAV/Auth/Backend/File.php | 8 +-
lib/DAV/Auth/Backend/PDO.php | 4 +-
lib/DAV/Auth/Plugin.php | 22 +-
lib/DAV/Browser/GuessContentType.php | 13 +-
lib/DAV/Browser/MapGetToPropFind.php | 11 +-
lib/DAV/Browser/Plugin.php | 153 +++++++-------
lib/DAV/Browser/PropFindAll.php | 8 +-
lib/DAV/Client.php | 52 ++---
lib/DAV/Collection.php | 7 +-
lib/DAV/CorePlugin.php | 4 +-
lib/DAV/Exception.php | 4 +-
lib/DAV/Exception/ConflictingLock.php | 4 +-
lib/DAV/Exception/InvalidResourceType.php | 4 +-
lib/DAV/Exception/InvalidSyncToken.php | 4 +-
lib/DAV/Exception/LockTokenMatchesRequestUri.php | 4 +-
lib/DAV/Exception/Locked.php | 7 +-
lib/DAV/Exception/MethodNotAllowed.php | 2 +-
lib/DAV/Exception/NotFound.php | 1 -
lib/DAV/Exception/PreconditionFailed.php | 4 +-
lib/DAV/Exception/ReportNotSupported.php | 4 +-
lib/DAV/Exception/RequestedRangeNotSatisfiable.php | 1 -
lib/DAV/Exception/TooManyMatches.php | 4 +-
lib/DAV/FS/Directory.php | 10 +-
lib/DAV/FS/File.php | 7 +-
lib/DAV/FS/Node.php | 8 +-
lib/DAV/FSExt/Directory.php | 19 +-
lib/DAV/FSExt/File.php | 12 +-
lib/DAV/File.php | 1 -
lib/DAV/ICollection.php | 1 -
lib/DAV/IExtendedCollection.php | 1 -
lib/DAV/IFile.php | 1 -
lib/DAV/INode.php | 1 -
lib/DAV/IProperties.php | 1 -
lib/DAV/IQuota.php | 1 -
lib/DAV/Locks/Backend/AbstractBackend.php | 3 -
lib/DAV/Locks/Backend/BackendInterface.php | 5 +-
lib/DAV/Locks/Backend/File.php | 28 +--
lib/DAV/Locks/Backend/PDO.php | 35 ++--
lib/DAV/Locks/LockInfo.php | 1 -
lib/DAV/Locks/Plugin.php | 77 ++++---
lib/DAV/MkCol.php | 8 +-
lib/DAV/Mount/Plugin.php | 13 +-
lib/DAV/Node.php | 1 -
lib/DAV/PartialUpdate/IPatchSupport.php | 1 -
lib/DAV/PartialUpdate/Plugin.php | 27 ++-
lib/DAV/PropFind.php | 16 +-
lib/DAV/PropPatch.php | 32 +--
lib/DAV/PropertyStorage/Backend/PDO.php | 15 +-
lib/DAV/Server.php | 227 ++++++++++-----------
lib/DAV/ServerPlugin.php | 1 -
lib/DAV/SimpleCollection.php | 2 +-
lib/DAV/StringUtil.php | 16 +-
lib/DAV/Sync/ISyncCollection.php | 1 -
lib/DAV/Sync/Plugin.php | 15 +-
lib/DAV/TemporaryFileFilterPlugin.php | 50 ++---
lib/DAV/Tree.php | 41 ++--
lib/DAV/UUIDUtil.php | 12 +-
lib/DAV/Xml/Element/Prop.php | 23 +--
lib/DAV/Xml/Element/Response.php | 10 +-
lib/DAV/Xml/Property/Complex.php | 12 +-
lib/DAV/Xml/Property/GetLastModified.php | 16 +-
lib/DAV/Xml/Property/Href.php | 6 +-
lib/DAV/Xml/Property/LockDiscovery.php | 21 +-
lib/DAV/Xml/Property/SupportedLock.php | 10 +-
lib/DAV/Xml/Property/SupportedMethodSet.php | 2 +-
lib/DAV/Xml/Property/SupportedReportSet.php | 6 +-
lib/DAV/Xml/Request/Lock.php | 4 +-
lib/DAV/Xml/Request/MkCol.php | 2 +-
lib/DAV/Xml/Request/PropFind.php | 4 +-
lib/DAV/Xml/Request/PropPatch.php | 4 +-
lib/DAV/Xml/Request/SyncCollectionReport.php | 8 +-
lib/DAV/Xml/Response/MultiStatus.php | 4 +-
lib/DAVACL/AbstractPrincipalCollection.php | 11 +-
lib/DAVACL/Exception/AceConflict.php | 4 +-
lib/DAVACL/Exception/NeedPrivileges.php | 19 +-
lib/DAVACL/Exception/NoAbstract.php | 4 +-
lib/DAVACL/Exception/NotRecognizedPrincipal.php | 4 +-
lib/DAVACL/Exception/NotSupportedPrivilege.php | 4 +-
lib/DAVACL/IACL.php | 1 +
lib/DAVACL/Plugin.php | 133 ++++++------
lib/DAVACL/Principal.php | 2 +-
lib/DAVACL/PrincipalBackend/AbstractBackend.php | 4 +-
lib/DAVACL/PrincipalBackend/PDO.php | 54 +++--
lib/DAVACL/PrincipalCollection.php | 9 +-
lib/DAVACL/Xml/Property/Acl.php | 18 +-
.../Xml/Property/CurrentUserPrivilegeSet.php | 4 +-
lib/DAVACL/Xml/Property/Principal.php | 8 +-
lib/DAVACL/Xml/Property/SupportedPrivilegeSet.php | 6 +-
lib/DAVACL/Xml/Request/ExpandPropertyReport.php | 4 +-
.../Xml/Request/PrincipalPropertySearchReport.php | 12 +-
158 files changed, 1318 insertions(+), 1409 deletions(-)
diff --git a/lib/CalDAV/Backend/AbstractBackend.php b/lib/CalDAV/Backend/AbstractBackend.php
index 37a8a17..3aef7a7 100644
--- a/lib/CalDAV/Backend/AbstractBackend.php
+++ b/lib/CalDAV/Backend/AbstractBackend.php
@@ -110,7 +110,7 @@ abstract class AbstractBackend implements BackendInterface {
$result = [];
$objects = $this->getCalendarObjects($calendarId);
- foreach($objects as $object) {
+ foreach ($objects as $object) {
if ($this->validateFilterForObject($object, $filters)) {
$result[] = $object['uri'];
@@ -169,38 +169,38 @@ abstract class AbstractBackend implements BackendInterface {
// Note: this is a super slow naive implementation of this method. You
// are highly recommended to optimize it, if your backend allows it.
- foreach($this->getCalendarsForUser($principalUri) as $calendar) {
+ foreach ($this->getCalendarsForUser($principalUri) as $calendar) {
// We must ignore calendars owned by other principals.
- if ($calendar['principaluri']!==$principalUri) {
+ if ($calendar['principaluri'] !== $principalUri) {
continue;
}
// Ignore calendars that are shared.
- if (isset($calendar['{http://sabredav.org/ns}owner-principal']) && $calendar['{http://sabredav.org/ns}owner-principal']!==$principalUri) {
+ if (isset($calendar['{http://sabredav.org/ns}owner-principal']) && $calendar['{http://sabredav.org/ns}owner-principal'] !== $principalUri) {
continue;
}
$results = $this->calendarQuery(
$calendar['id'],
[
- 'name' => 'VCALENDAR',
+ 'name' => 'VCALENDAR',
'prop-filters' => [],
'comp-filters' => [
[
- 'name' => 'VEVENT',
+ 'name' => 'VEVENT',
'is-not-defined' => false,
- 'time-range' => null,
- 'comp-filters' => [],
- 'prop-filters' => [
+ 'time-range' => null,
+ 'comp-filters' => [],
+ 'prop-filters' => [
[
- 'name' => 'UID',
+ 'name' => 'UID',
'is-not-defined' => false,
- 'time-range' => null,
- 'text-match' => [
- 'value' => $uid,
+ 'time-range' => null,
+ 'text-match' => [
+ 'value' => $uid,
'negate-condition' => false,
- 'collation' => 'i;octet',
+ 'collation' => 'i;octet',
],
'param-filters' => [],
],
diff --git a/lib/CalDAV/Backend/BackendInterface.php b/lib/CalDAV/Backend/BackendInterface.php
index 980eb69..17b79f0 100644
--- a/lib/CalDAV/Backend/BackendInterface.php
+++ b/lib/CalDAV/Backend/BackendInterface.php
@@ -49,7 +49,7 @@ interface BackendInterface {
* @param array $properties
* @return void
*/
- function createCalendar($principalUri,$calendarUri,array $properties);
+ function createCalendar($principalUri, $calendarUri, array $properties);
/**
* Updates properties for a calendar.
@@ -126,7 +126,7 @@ interface BackendInterface {
* @param string $objectUri
* @return array|null
*/
- function getCalendarObject($calendarId,$objectUri);
+ function getCalendarObject($calendarId, $objectUri);
/**
* Returns a list of calendar objects.
@@ -160,7 +160,7 @@ interface BackendInterface {
* @param string $calendarData
* @return string|null
*/
- function createCalendarObject($calendarId,$objectUri,$calendarData);
+ function createCalendarObject($calendarId, $objectUri, $calendarData);
/**
* Updates an existing calendarobject, based on it's uri.
@@ -180,7 +180,7 @@ interface BackendInterface {
* @param string $calendarData
* @return string|null
*/
- function updateCalendarObject($calendarId,$objectUri,$calendarData);
+ function updateCalendarObject($calendarId, $objectUri, $calendarData);
/**
* Deletes an existing calendar object.
@@ -191,7 +191,7 @@ interface BackendInterface {
* @param string $objectUri
* @return void
*/
- function deleteCalendarObject($calendarId,$objectUri);
+ function deleteCalendarObject($calendarId, $objectUri);
/**
* Performs a calendar-query on the contents of this calendar.
diff --git a/lib/CalDAV/Backend/PDO.php b/lib/CalDAV/Backend/PDO.php
index 9b6c809..dc22b64 100644
--- a/lib/CalDAV/Backend/PDO.php
+++ b/lib/CalDAV/Backend/PDO.php
@@ -2,11 +2,10 @@
namespace Sabre\CalDAV\Backend;
-use
- Sabre\VObject,
- Sabre\CalDAV,
- Sabre\DAV,
- Sabre\DAV\Exception\Forbidden;
+use Sabre\VObject;
+use Sabre\CalDAV;
+use Sabre\DAV;
+use Sabre\DAV\Exception\Forbidden;
/**
* PDO CalDAV backend
@@ -81,11 +80,11 @@ class PDO extends AbstractBackend implements SyncSupport, SubscriptionSupport, S
* @var array
*/
public $propertyMap = [
- '{DAV:}displayname' => 'displayname',
+ '{DAV:}displayname' => 'displayname',
'{urn:ietf:params:xml:ns:caldav}calendar-description' => 'description',
'{urn:ietf:params:xml:ns:caldav}calendar-timezone' => 'timezone',
- '{http://apple.com/ns/ical/}calendar-order' => 'calendarorder',
- '{http://apple.com/ns/ical/}calendar-color' => 'calendarcolor',
+ '{http://apple.com/ns/ical/}calendar-order' => 'calendarorder',
+ '{http://apple.com/ns/ical/}calendar-color' => 'calendarcolor',
];
/**
@@ -150,29 +149,29 @@ class PDO extends AbstractBackend implements SyncSupport, SubscriptionSupport, S
// Making fields a comma-delimited list
$fields = implode(', ', $fields);
- $stmt = $this->pdo->prepare("SELECT " . $fields . " FROM ".$this->calendarTableName." WHERE principaluri = ? ORDER BY calendarorder ASC");
+ $stmt = $this->pdo->prepare("SELECT " . $fields . " FROM " . $this->calendarTableName . " WHERE principaluri = ? ORDER BY calendarorder ASC");
$stmt->execute([$principalUri]);
$calendars = [];
- while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
+ while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
$components = [];
if ($row['components']) {
- $components = explode(',',$row['components']);
+ $components = explode(',', $row['components']);
}
$calendar = [
- 'id' => $row['id'],
- 'uri' => $row['uri'],
- 'principaluri' => $row['principaluri'],
- '{' . CalDAV\Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'),
- '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
+ 'id' => $row['id'],
+ 'uri' => $row['uri'],
+ 'principaluri' => $row['principaluri'],
+ '{' . CalDAV\Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken'] ? $row['synctoken'] : '0'),
+ '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
'{' . CalDAV\Plugin::NS_CALDAV . '}supported-calendar-component-set' => new CalDAV\Xml\Property\SupportedCalendarComponentSet($components),
- '{' . CalDAV\Plugin::NS_CALDAV . '}schedule-calendar-transp' => new CalDAV\Xml\Property\ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'),
+ '{' . CalDAV\Plugin::NS_CALDAV . '}schedule-calendar-transp' => new CalDAV\Xml\Property\ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
];
- foreach($this->propertyMap as $xmlName=>$dbName) {
+ foreach ($this->propertyMap as $xmlName => $dbName) {
$calendar[$xmlName] = $row[$dbName];
}
@@ -219,14 +218,14 @@ class PDO extends AbstractBackend implements SyncSupport, SubscriptionSupport, S
if (!($properties[$sccs] instanceof CalDAV\Xml\Property\SupportedCalendarComponentSet)) {
throw new DAV\Exception('The ' . $sccs . ' property must be of type: \Sabre\CalDAV\Xml\Property\SupportedCalendarComponentSet');
}
- $values[':components'] = implode(',',$properties[$sccs]->getValue());
+ $values[':components'] = implode(',', $properties[$sccs]->getValue());
}
$transp = '{' . CalDAV\Plugin::NS_CALDAV . '}schedule-calendar-transp';
if (isset($properties[$transp])) {
- $values[':transparent'] = $properties[$transp]->getValue()==='transparent';
+ $values[':transparent'] = $properties[$transp]->getValue() === 'transparent';
}
- foreach($this->propertyMap as $xmlName=>$dbName) {
+ foreach ($this->propertyMap as $xmlName => $dbName) {
if (isset($properties[$xmlName])) {
$values[':' . $dbName] = $properties[$xmlName];
@@ -234,7 +233,7 @@ class PDO extends AbstractBackend implements SyncSupport, SubscriptionSupport, S
}
}
- $stmt = $this->pdo->prepare("INSERT INTO ".$this->calendarTableName." (".implode(', ', $fieldNames).") VALUES (".implode(', ',array_keys($values)).")");
+ $stmt = $this->pdo->prepare("INSERT INTO " . $this->calendarTableName . " (" . implode(', ', $fieldNames) . ") VALUES (" . implode(', ', array_keys($values)) . ")");
$stmt->execute($values);
return $this->pdo->lastInsertId();
@@ -264,12 +263,12 @@ class PDO extends AbstractBackend implements SyncSupport, SubscriptionSupport, S
$propPatch->handle($supportedProperties, function($mutations) use ($calendarId) {
$newValues = [];
- foreach($mutations as $propertyName=>$propertyValue) {
+ foreach ($mutations as $propertyName => $propertyValue) {
- switch($propertyName) {
+ switch ($propertyName) {
case '{' . CalDAV\Plugin::NS_CALDAV . '}schedule-calendar-transp' :
$fieldName = 'transparent';
- $newValues[$fieldName] = $propertyValue->getValue()==='transparent';
+ $newValues[$fieldName] = $propertyValue->getValue() === 'transparent';
break;
default :
$fieldName = $this->propertyMap[$propertyName];
@@ -279,11 +278,11 @@ class PDO extends AbstractBackend implements SyncSupport, SubscriptionSupport, S
}
$valuesSql = [];
- foreach($newValues as $fieldName=>$value) {
+ foreach ($newValues as $fieldName => $value) {
$valuesSql[] = $fieldName . ' = ?';
}
- $stmt = $this->pdo->prepare("UPDATE " . $this->calendarTableName . " SET " . implode(', ',$valuesSql) . " WHERE id = ?");
+ $stmt = $this->pdo->prepare("UPDATE " . $this->calendarTableName . " SET " . implode(', ', $valuesSql) . " WHERE id = ?");
$newValues['id'] = $calendarId;
$stmt->execute(array_values($newValues));
@@ -303,13 +302,13 @@ class PDO extends AbstractBackend implements SyncSupport, SubscriptionSupport, S
*/
function deleteCalendar($calendarId) {
- $stmt = $this->pdo->prepare('DELETE FROM '.$this->calendarObjectTableName.' WHERE calendarid = ?');
+ $stmt = $this->pdo->prepare('DELETE FROM ' . $this->calendarObjectTableName . ' WHERE calendarid = ?');
$stmt->execute([$calendarId]);
- $stmt = $this->pdo->prepare('DELETE FROM '.$this->calendarTableName.' WHERE id = ?');
+ $stmt = $this->pdo->prepare('DELETE FROM ' . $this->calendarTableName . ' WHERE id = ?');
$stmt->execute([$calendarId]);
- $stmt = $this->pdo->prepare('DELETE FROM '.$this->calendarChangesTableName.' WHERE calendarid = ?');
+ $stmt = $this->pdo->prepare('DELETE FROM ' . $this->calendarChangesTableName . ' WHERE calendarid = ?');
$stmt->execute([$calendarId]);
}
@@ -347,11 +346,11 @@ class PDO extends AbstractBackend implements SyncSupport, SubscriptionSupport, S
*/
function getCalendarObjects($calendarId) {
- $stmt = $this->pdo->prepare('SELECT id, uri, lastmodified, etag, calendarid, size, componenttype FROM '.$this->calendarObjectTableName.' WHERE calendarid = ?');
+ $stmt = $this->pdo->prepare('SELECT id, uri, lastmodified, etag, calendarid, size, componenttype FROM ' . $this->calendarObjectTableName . ' WHERE calendarid = ?');
$stmt->execute([$calendarId]);
$result = [];
- foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) {
+ foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) {
$result[] = [
'id' => $row['id'],
'uri' => $row['uri'],
@@ -383,13 +382,13 @@ class PDO extends AbstractBackend implements SyncSupport, SubscriptionSupport, S
* @param string $objectUri
* @return array|null
*/
- function getCalendarObject($calendarId,$objectUri) {
+ function getCalendarObject($calendarId, $objectUri) {
- $stmt = $this->pdo->prepare('SELECT id, uri, lastmodified, etag, calendarid, size, calendardata, componenttype FROM '.$this->calendarObjectTableName.' WHERE calendarid = ? AND uri = ?');
+ $stmt = $this->pdo->prepare('SELECT id, uri, lastmodified, etag, calendarid, size, calendardata, componenttype FROM ' . $this->calendarObjectTableName . ' WHERE calendarid = ? AND uri = ?');
$stmt->execute([$calendarId, $objectUri]);
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
- if(!$row) return null;
+ if (!$row) return null;
return [
'id' => $row['id'],
@@ -418,16 +417,16 @@ class PDO extends AbstractBackend implements SyncSupport, SubscriptionSupport, S
*/
function getMultipleCalendarObjects($calendarId, array $uris) {
- $query = 'SELECT id, uri, lastmodified, etag, calendarid, size, calendardata, componenttype FROM '.$this->calendarObjectTableName.' WHERE calendarid = ? AND uri IN (';
+ $query = 'SELECT id, uri, lastmodified, etag, calendarid, size, calendardata, componenttype FROM ' . $this->calendarObjectTableName . ' WHERE calendarid = ? AND uri IN (';
// Inserting a whole bunch of question marks
- $query.=implode(',', array_fill(0, count($uris), '?'));
- $query.=')';
+ $query .= implode(',', array_fill(0, count($uris), '?'));
+ $query .= ')';
$stmt = $this->pdo->prepare($query);
$stmt->execute(array_merge([$calendarId], $uris));
$result = [];
- while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
+ while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
$result[] = [
'id' => $row['id'],
@@ -464,11 +463,11 @@ class PDO extends AbstractBackend implements SyncSupport, SubscriptionSupport, S
* @param string $calendarData
* @return string|null
*/
- function createCalendarObject($calendarId,$objectUri,$calendarData) {
+ function createCalendarObject($calendarId, $objectUri, $calendarData) {
$extraData = $this->getDenormalizedData($calendarData);
- $stmt = $this->pdo->prepare('INSERT INTO '.$this->calendarObjectTableName.' (calendarid, uri, calendardata, lastmodified, etag, size, componenttype, firstoccurence, lastoccurence, uid) VALUES (?,?,?,?,?,?,?,?,?,?)');
+ $stmt = $this->pdo->prepare('INSERT INTO ' . $this->calendarObjectTableName . ' (calendarid, uri, calendardata, lastmodified, etag, size, componenttype, firstoccurence, lastoccurence, uid) VALUES (?,?,?,?,?,?,?,?,?,?)');
$stmt->execute([
$calendarId,
$objectUri,
@@ -505,11 +504,11 @@ class PDO extends AbstractBackend implements SyncSupport, SubscriptionSupport, S
* @param string $calendarData
* @return string|null
*/
- function updateCalendarObject($calendarId,$objectUri,$calendarData) {
+ function updateCalendarObject($calendarId, $objectUri, $calendarData) {
$extraData = $this->getDenormalizedData($calendarData);
- $stmt = $this->pdo->prepare('UPDATE '.$this->calendarObjectTableName.' SET calendardata = ?, lastmodified = ?, etag = ?, size = ?, componenttype = ?, firstoccurence = ?, lastoccurence = ?, uid = ? WHERE calendarid = ? AND uri = ?');
+ $stmt = $this->pdo->prepare('UPDATE ' . $this->calendarObjectTableName . ' SET calendardata = ?, lastmodified = ?, etag = ?, size = ?, componenttype = ?, firstoccurence = ?, lastoccurence = ?, uid = ? WHERE calendarid = ? AND uri = ?');
$stmt->execute([$calendarData, time(), $extraData['etag'], $extraData['size'], $extraData['componentType'], $extraData['firstOccurence'], $extraData['lastOccurence'], $extraData['uid'], $calendarId, $objectUri]);
$this->addChange($calendarId, $objectUri, 2);
@@ -541,8 +540,8 @@ class PDO extends AbstractBackend implements SyncSupport, SubscriptionSupport, S
$firstOccurence = null;
$lastOccurence = null;
$uid = null;
- foreach($vObject->getComponents() as $component) {
- if ($component->name!=='VTIMEZONE') {
+ foreach ($vObject->getComponents() as $component) {
+ if ($component->name !== 'VTIMEZONE') {
$componentType = $component->name;
$uid = (string)$component->UID;
break;
@@ -575,7 +574,7 @@ class PDO extends AbstractBackend implements SyncSupport, SubscriptionSupport, S
$lastOccurence = $maxDate->getTimeStamp();
} else {
$end = $it->getDtEnd();
- while($it->valid() && $end < $maxDate) {
+ while ($it->valid() && $end < $maxDate) {
$end = $it->getDtEnd();
$it->next();
@@ -587,12 +586,12 @@ class PDO extends AbstractBackend implements SyncSupport, SubscriptionSupport, S
}
return [
- 'etag' => md5($calendarData),
- 'size' => strlen($calendarData),
- 'componentType' => $componentType,
+ 'etag' => md5($calendarData),
+ 'size' => strlen($calendarData),
+ 'componentType' => $componentType,
'firstOccurence' => $firstOccurence,
'lastOccurence' => $lastOccurence,
- 'uid' => $uid,
+ 'uid' => $uid,
];
}
@@ -606,9 +605,9 @@ class PDO extends AbstractBackend implements SyncSupport, SubscriptionSupport, S
* @param string $objectUri
* @return void
*/
- function deleteCalendarObject($calendarId,$objectUri) {
+ function deleteCalendarObject($calendarId, $objectUri) {
- $stmt = $this->pdo->prepare('DELETE FROM '.$this->calendarObjectTableName.' WHERE calendarid = ? AND uri = ?');
+ $stmt = $this->pdo->prepare('DELETE FROM ' . $this->calendarObjectTableName . ' WHERE calendarid = ? AND uri = ?');
$stmt->execute([$calendarId, $objectUri]);
$this->addChange($calendarId, $objectUri, 3);
@@ -700,9 +699,9 @@ class PDO extends AbstractBackend implements SyncSupport, SubscriptionSupport, S
}
if ($requirePostFilter) {
- $query = "SELECT uri, calendardata FROM ".$this->calendarObjectTableName." WHERE calendarid = :calendarid";
+ $query = "SELECT uri, calendardata FROM " . $this->calendarObjectTableName . " WHERE calendarid = :calendarid";
} else {
- $query = "SELECT uri FROM ".$this->calendarObjectTableName." WHERE calendarid = :calendarid";
+ $query = "SELECT uri FROM " . $this->calendarObjectTableName . " WHERE calendarid = :calendarid";
}
$values = [
@@ -710,16 +709,16 @@ class PDO extends AbstractBackend implements SyncSupport, SubscriptionSupport, S
];
if ($componentType) {
- $query.=" AND componenttype = :componenttype";
+ $query .= " AND componenttype = :componenttype";
$values['componenttype'] = $componentType;
}
if ($timeRange && $timeRange['start']) {
- $query.=" AND lastoccurence > :startdate";
+ $query .= " AND lastoccurence > :startdate";
$values['startdate'] = $timeRange['start']->getTimeStamp();
}
if ($timeRange && $timeRange['end']) {
- $query.=" AND firstoccurence < :enddate";
+ $query .= " AND firstoccurence < :enddate";
$values['enddate'] = $timeRange['end']->getTimeStamp();
}
@@ -727,7 +726,7 @@ class PDO extends AbstractBackend implements SyncSupport, SubscriptionSupport, S
$stmt->execute($values);
$result = [];
- while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
+ while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
if ($requirePostFilter) {
if (!$this->validateFilterForObject($row, $filters)) {
continue;
@@ -844,7 +843,7 @@ SQL;
function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null) {
// Current synctoken
- $stmt = $this->pdo->prepare('SELECT synctoken FROM ' .$this->calendarTableName . ' WHERE id = ?');
+ $stmt = $this->pdo->prepare('SELECT synctoken FROM ' . $this->calendarTableName . ' WHERE id = ?');
$stmt->execute([ $calendarId ]);
$currentToken = $stmt->fetchColumn(0);
@@ -860,7 +859,7 @@ SQL;
if ($syncToken) {
$query = "SELECT uri, operation FROM " . $this->calendarChangesTableName . " WHERE synctoken >= ? AND synctoken < ? AND calendarid = ? ORDER BY synctoken";
- if ($limit>0) $query.= " LIMIT " . (int)$limit;
+ if ($limit > 0) $query .= " LIMIT " . (int)$limit;
// Fetching all changes
$stmt = $this->pdo->prepare($query);
@@ -870,15 +869,15 @@ SQL;
// This loop ensures that any duplicates are overwritten, only the
// last change on a node is relevant.
- while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
+ while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
$changes[$row['uri']] = $row['operation'];
}
- foreach($changes as $uri => $operation) {
+ foreach ($changes as $uri => $operation) {
- switch($operation) {
+ switch ($operation) {
case 1 :
$result['added'][] = $uri;
break;
@@ -913,7 +912,7 @@ SQL;
*/
protected function addChange($calendarId, $objectUri, $operation) {
- $stmt = $this->pdo->prepare('INSERT INTO ' . $this->calendarChangesTableName .' (uri, synctoken, calendarid, operation) SELECT ?, synctoken, ?, ? FROM ' . $this->calendarTableName .' WHERE id = ?');
+ $stmt = $this->pdo->prepare('INSERT INTO ' . $this->calendarChangesTableName . ' (uri, synctoken, calendarid, operation) SELECT ?, synctoken, ?, ? FROM ' . $this->calendarTableName . ' WHERE id = ?');
$stmt->execute([
$objectUri,
$calendarId,
@@ -973,7 +972,7 @@ SQL;
$stmt->execute([$principalUri]);
$subscriptions = [];
- while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
+ while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
$subscription = [
'id' => $row['id'],
@@ -985,7 +984,7 @@ SQL;
'{' . CalDAV\Plugin::NS_CALDAV . '}supported-calendar-component-set' => new CalDAV\Xml\Property\SupportedCalendarComponentSet(['VTODO', 'VEVENT']),
];
- foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) {
+ foreach ($this->subscriptionPropertyMap as $xmlName => $dbName) {
if (!is_null($row[$dbName])) {
$subscription[$xmlName] = $row[$dbName];
}
@@ -1030,7 +1029,7 @@ SQL;
':lastmodified' => time(),
];
- foreach($this->subscriptionPropertyMap as $xmlName=>$dbName) {
+ foreach ($this->subscriptionPropertyMap as $xmlName => $dbName) {
if (isset($properties[$xmlName])) {
$values[':' . $dbName] = $properties[$xmlName];
@@ -1038,7 +1037,7 @@ SQL;
}
}
- $stmt = $this->pdo->prepare("INSERT INTO " . $this->calendarSubscriptionsTableName . " (".implode(', ', $fieldNames).") VALUES (".implode(', ',array_keys($values)).")");
+ $stmt = $this->pdo->prepare("INSERT INTO " . $this->calendarSubscriptionsTableName . " (" . implode(', ', $fieldNames) . ") VALUES (" . implode(', ', array_keys($values)) . ")");
$stmt->execute($values);
return $this->pdo->lastInsertId();
@@ -1070,7 +1069,7 @@ SQL;
$newValues = [];
- foreach($mutations as $propertyName=>$propertyValue) {
+ foreach ($mutations as $propertyName => $propertyValue) {
if ($propertyName === '{http://calendarserver.org/ns/}source') {
$newValues['source'] = $propertyValue->getHref();
@@ -1083,11 +1082,11 @@ SQL;
// Now we're generating the sql query.
$valuesSql = [];
- foreach($newValues as $fieldName=>$value) {
+ foreach ($newValues as $fieldName => $value) {
$valuesSql[] = $fieldName . ' = ?';
}
- $stmt = $this->pdo->prepare("UPDATE " . $this->calendarSubscriptionsTableName . " SET " . implode(', ',$valuesSql) . ", lastmodified = ? WHERE id = ?");
+ $stmt = $this->pdo->prepare("UPDATE " . $this->calendarSubscriptionsTableName . " SET " . implode(', ', $valuesSql) . ", lastmodified = ? WHERE id = ?");
$newValues['lastmodified'] = time();
$newValues['id'] = $subscriptionId;
$stmt->execute(array_values($newValues));
@@ -1129,11 +1128,11 @@ SQL;
*/
function getSchedulingObject($principalUri, $objectUri) {
- $stmt = $this->pdo->prepare('SELECT uri, calendardata, lastmodified, etag, size FROM '.$this->schedulingObjectTableName.' WHERE principaluri = ? AND uri = ?');
+ $stmt = $this->pdo->prepare('SELECT uri, calendardata, lastmodified, etag, size FROM ' . $this->schedulingObjectTableName . ' WHERE principaluri = ? AND uri = ?');
$stmt->execute([$principalUri, $objectUri]);
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
- if(!$row) return null;
+ if (!$row) return null;
return [
'uri' => $row['uri'],
@@ -1158,11 +1157,11 @@ SQL;
*/
function getSchedulingObjects($principalUri) {
- $stmt = $this->pdo->prepare('SELECT id, calendardata, uri, lastmodified, etag, size FROM '.$this->schedulingObjectTableName.' WHERE principaluri = ?');
+ $stmt = $this->pdo->prepare('SELECT id, calendardata, uri, lastmodified, etag, size FROM ' . $this->schedulingObjectTableName . ' WHERE principaluri = ?');
$stmt->execute([$principalUri]);
$result = [];
- foreach($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) {
+ foreach ($stmt->fetchAll(\PDO::FETCH_ASSOC) as $row) {
$result[] = [
'calendardata' => $row['calendardata'],
'uri' => $row['uri'],
@@ -1185,7 +1184,7 @@ SQL;
*/
function deleteSchedulingObject($principalUri, $objectUri) {
- $stmt = $this->pdo->prepare('DELETE FROM '.$this->schedulingObjectTableName.' WHERE principaluri = ? AND uri = ?');
+ $stmt = $this->pdo->prepare('DELETE FROM ' . $this->schedulingObjectTableName . ' WHERE principaluri = ? AND uri = ?');
$stmt->execute([$principalUri, $objectUri]);
}
@@ -1200,7 +1199,7 @@ SQL;
*/
function createSchedulingObject($principalUri, $objectUri, $objectData) {
- $stmt = $this->pdo->prepare('INSERT INTO '.$this->schedulingObjectTableName.' (principaluri, calendardata, uri, lastmodified, etag, size) VALUES (?, ?, ?, ?, ?, ?)');
+ $stmt = $this->pdo->prepare('INSERT INTO ' . $this->schedulingObjectTableName . ' (principaluri, calendardata, uri, lastmodified, etag, size) VALUES (?, ?, ?, ?, ?, ?)');
$stmt->execute([$principalUri, $objectData, $objectUri, time(), md5($objectData), strlen($objectData) ]);
}
diff --git a/lib/CalDAV/Calendar.php b/lib/CalDAV/Calendar.php
index 493e2ef..d8a7117 100644
--- a/lib/CalDAV/Calendar.php
+++ b/lib/CalDAV/Calendar.php
@@ -2,10 +2,9 @@
namespace Sabre\CalDAV;
-use
- Sabre\DAV,
- Sabre\DAVACL,
- Sabre\DAV\PropPatch;
+use Sabre\DAV;
+use Sabre\DAVACL;
+use Sabre\DAV\PropPatch;
/**
* This object represents a CalDAV calendar.
@@ -85,9 +84,9 @@ class Calendar implements ICalendar, DAV\IProperties, DAV\Sync\ISyncCollection,
$response = [];
- foreach($this->calendarInfo as $propName=>$propValue) {
+ foreach ($this->calendarInfo as $propName => $propValue) {
- if ($propName[0]==='{')
+ if ($propName[0] === '{')
$response[$propName] = $this->calendarInfo[$propName];
}
@@ -105,13 +104,13 @@ class Calendar implements ICalendar, DAV\IProperties, DAV\Sync\ISyncCollection,
*/
function getChild($name) {
- $obj = $this->caldavBackend->getCalendarObject($this->calendarInfo['id'],$name);
+ $obj = $this->caldavBackend->getCalendarObject($this->calendarInfo['id'], $name);
if (!$obj) throw new DAV\Exception\NotFound('Calendar object not found');
$obj['acl'] = $this->getChildACL();
- return new CalendarObject($this->caldavBackend,$this->calendarInfo,$obj);
+ return new CalendarObject($this->caldavBackend, $this->calendarInfo, $obj);
}
@@ -124,9 +123,9 @@ class Calendar implements ICalendar, DAV\IProperties, DAV\Sync\ISyncCollection,
$objs = $this->caldavBackend->getCalendarObjects($this->calendarInfo['id']);
$children = [];
- foreach($objs as $obj) {
+ foreach ($objs as $obj) {
$obj['acl'] = $this->getChildACL();
- $children[] = new CalendarObject($this->caldavBackend,$this->calendarInfo,$obj);
+ $children[] = new CalendarObject($this->caldavBackend, $this->calendarInfo, $obj);
}
return $children;
@@ -144,9 +143,9 @@ class Calendar implements ICalendar, DAV\IProperties, DAV\Sync\ISyncCollection,
$objs = $this->caldavBackend->getMultipleCalendarObjects($this->calendarInfo['id'], $paths);
$children = [];
- foreach($objs as $obj) {
+ foreach ($objs as $obj) {
$obj['acl'] = $this->getChildACL();
- $children[] = new CalendarObject($this->caldavBackend,$this->calendarInfo,$obj);
+ $children[] = new CalendarObject($this->caldavBackend, $this->calendarInfo, $obj);
}
return $children;
@@ -160,7 +159,7 @@ class Calendar implements ICalendar, DAV\IProperties, DAV\Sync\ISyncCollection,
*/
function childExists($name) {
- $obj = $this->caldavBackend->getCalendarObject($this->calendarInfo['id'],$name);
+ $obj = $this->caldavBackend->getCalendarObject($this->calendarInfo['id'], $name);
if (!$obj)
return false;
else
@@ -191,12 +190,12 @@ class Calendar implements ICalendar, DAV\IProperties, DAV\Sync\ISyncCollection,
* @param resource $calendarData
* @return string|null
*/
- function createFile($name,$calendarData = null) {
+ function createFile($name, $calendarData = null) {
if (is_resource($calendarData)) {
$calendarData = stream_get_contents($calendarData);
}
- return $this->caldavBackend->createCalendarObject($this->calendarInfo['id'],$name,$calendarData);
+ return $this->caldavBackend->createCalendarObject($this->calendarInfo['id'], $name, $calendarData);
}
@@ -392,7 +391,7 @@ class Calendar implements ICalendar, DAV\IProperties, DAV\Sync\ISyncCollection,
// We need to inject 'read-free-busy' in the tree, aggregated under
// {DAV:}read.
- foreach($default['aggregates'] as &$agg) {
+ foreach ($default['aggregates'] as &$agg) {
if ($agg['privilege'] !== '{DAV:}read') continue;
diff --git a/lib/CalDAV/CalendarHome.php b/lib/CalDAV/CalendarHome.php
index af3bd83..93a1422 100644
--- a/lib/CalDAV/CalendarHome.php
+++ b/lib/CalDAV/CalendarHome.php
@@ -2,12 +2,11 @@
namespace Sabre\CalDAV;
-use
- Sabre\DAV,
- Sabre\DAV\Exception\NotFound,
- Sabre\DAV\MkCol,
- Sabre\DAVACL,
- Sabre\HTTP\URLUtil;
+use Sabre\DAV;
+use Sabre\DAV\Exception\NotFound;
+use Sabre\DAV\MkCol;
+use Sabre\DAVACL;
+use Sabre\HTTP\URLUtil;
/**
* The CalendarHome represents a node that is usually in a users'
@@ -57,7 +56,7 @@ class CalendarHome implements DAV\IExtendedCollection, DAVACL\IACL {
*/
function getName() {
- list(,$name) = URLUtil::splitPath($this->principalInfo['uri']);
+ list(, $name) = URLUtil::splitPath($this->principalInfo['uri']);
return $name;
}
@@ -105,7 +104,7 @@ class CalendarHome implements DAV\IExtendedCollection, DAVACL\IACL {
* @param resource $data
* @return void
*/
- function createFile($filename, $data=null) {
+ function createFile($filename, $data = null) {
throw new DAV\Exception\MethodNotAllowed('Creating new files in this collection is not supported');
@@ -145,7 +144,7 @@ class CalendarHome implements DAV\IExtendedCollection, DAVACL\IACL {
}
// Calendars
- foreach($this->caldavBackend->getCalendarsForUser($this->principalInfo['uri']) as $calendar) {
+ foreach ($this->caldavBackend->getCalendarsForUser($this->principalInfo['uri']) as $calendar) {
if ($calendar['uri'] === $name) {
if ($this->caldavBackend instanceof Backend\SharingSupport) {
if (isset($calendar['{http://calendarserver.org/ns/}shared-url'])) {
@@ -160,7 +159,7 @@ class CalendarHome implements DAV\IExtendedCollection, DAVACL\IACL {
}
if ($this->caldavBackend instanceof Backend\SubscriptionSupport) {
- foreach($this->caldavBackend->getSubscriptionsForUser($this->principalInfo['uri']) as $subscription) {
+ foreach ($this->caldavBackend->getSubscriptionsForUser($this->principalInfo['uri']) as $subscription) {
if ($subscription['uri'] === $name) {
return new Subscriptions\Subscription($this->caldavBackend, $subscription);
}
@@ -197,7 +196,7 @@ class CalendarHome implements DAV\IExtendedCollection, DAVACL\IACL {
$calendars = $this->caldavBackend->getCalendarsForUser($this->principalInfo['uri']);
$objs = [];
- foreach($calendars as $calendar) {
+ foreach ($calendars as $calendar) {
if ($this->caldavBackend instanceof Backend\SharingSupport) {
if (isset($calendar['{http://calendarserver.org/ns/}shared-url'])) {
$objs[] = new SharedCalendar($this->caldavBackend, $calendar);
@@ -221,7 +220,7 @@ class CalendarHome implements DAV\IExtendedCollection, DAVACL\IACL {
// If the backend supports subscriptions, we'll add those as well,
if ($this->caldavBackend instanceof Backend\SubscriptionSupport) {
- foreach($this->caldavBackend->getSubscriptionsForUser($this->principalInfo['uri']) as $subscription) {
+ foreach ($this->caldavBackend->getSubscriptionsForUser($this->principalInfo['uri']) as $subscription) {
$objs[] = new Subscriptions\Subscription($this->caldavBackend, $subscription);
}
}
@@ -242,7 +241,7 @@ class CalendarHome implements DAV\IExtendedCollection, DAVACL\IACL {
$isCalendar = false;
$isSubscription = false;
- foreach($mkCol->getResourceType() as $rt) {
+ foreach ($mkCol->getResourceType() as $rt) {
switch ($rt) {
case '{DAV:}collection' :
case '{http://calendarserver.org/ns/}shared-owner' :
diff --git a/lib/CalDAV/CalendarObject.php b/lib/CalDAV/CalendarObject.php
index 3f8f5af..534c26a 100644
--- a/lib/CalDAV/CalendarObject.php
+++ b/lib/CalDAV/CalendarObject.php
@@ -50,7 +50,7 @@ class CalendarObject extends \Sabre\DAV\File implements ICalendarObject, \Sabre\
* @param array $calendarInfo
* @param array $objectData
*/
- function __construct(Backend\BackendInterface $caldavBackend,array $calendarInfo,array $objectData) {
+ function __construct(Backend\BackendInterface $caldavBackend, array $calendarInfo, array $objectData) {
$this->caldavBackend = $caldavBackend;
@@ -101,7 +101,7 @@ class CalendarObject extends \Sabre\DAV\File implements ICalendarObject, \Sabre\
if (is_resource($calendarData)) {
$calendarData = stream_get_contents($calendarData);
}
- $etag = $this->caldavBackend->updateCalendarObject($this->calendarInfo['id'],$this->objectData['uri'],$calendarData);
+ $etag = $this->caldavBackend->updateCalendarObject($this->calendarInfo['id'], $this->objectData['uri'], $calendarData);
$this->objectData['calendardata'] = $calendarData;
$this->objectData['etag'] = $etag;
@@ -116,7 +116,7 @@ class CalendarObject extends \Sabre\DAV\File implements ICalendarObject, \Sabre\
*/
function delete() {
- $this->caldavBackend->deleteCalendarObject($this->calendarInfo['id'],$this->objectData['uri']);
+ $this->caldavBackend->deleteCalendarObject($this->calendarInfo['id'], $this->objectData['uri']);
}
@@ -129,7 +129,7 @@ class CalendarObject extends \Sabre\DAV\File implements ICalendarObject, \Sabre\
$mime = 'text/calendar; charset=utf-8';
if (isset($this->objectData['component']) && $this->objectData['component']) {
- $mime.='; component=' . $this->objectData['component'];
+ $mime .= '; component=' . $this->objectData['component'];
}
return $mime;
@@ -147,7 +147,7 @@ class CalendarObject extends \Sabre\DAV\File implements ICalendarObject, \Sabre\
if (isset($this->objectData['etag'])) {
return $this->objectData['etag'];
} else {
- return '"' . md5($this->get()). '"';
+ return '"' . md5($this->get()) . '"';
}
}
@@ -170,7 +170,7 @@ class CalendarObject extends \Sabre\DAV\File implements ICalendarObject, \Sabre\
*/
function getSize() {
- if (array_key_exists('size',$this->objectData)) {
+ if (array_key_exists('size', $this->objectData)) {
return $this->objectData['size'];
} else {
return strlen($this->get());
@@ -288,4 +288,3 @@ class CalendarObject extends \Sabre\DAV\File implements ICalendarObject, \Sabre\
}
}
-
diff --git a/lib/CalDAV/CalendarQueryValidator.php b/lib/CalDAV/CalendarQueryValidator.php
index 3b56fcc..e78ca68 100644
--- a/lib/CalDAV/CalendarQueryValidator.php
+++ b/lib/CalDAV/CalendarQueryValidator.php
@@ -29,7 +29,7 @@ class CalendarQueryValidator {
* @param array $filters
* @return bool
*/
- function validate(VObject\Component\VCalendar $vObject,array $filters) {
+ function validate(VObject\Component\VCalendar $vObject, array $filters) {
// The top level object is always a component filter.
// We'll parse it manually, as it's pretty simple.
@@ -57,7 +57,7 @@ class CalendarQueryValidator {
*/
protected function validateCompFilters(VObject\Component $parent, array $filters) {
- foreach($filters as $filter) {
+ foreach ($filters as $filter) {
$isDefined = isset($parent->$filter['name']);
@@ -75,7 +75,7 @@ class CalendarQueryValidator {
}
if ($filter['time-range']) {
- foreach($parent->$filter['name'] as $subComponent) {
+ foreach ($parent->$filter['name'] as $subComponent) {
if ($this->validateTimeRange($subComponent, $filter['time-range']['start'], $filter['time-range']['end'])) {
continue 2;
}
@@ -89,7 +89,7 @@ class CalendarQueryValidator {
// If there are sub-filters, we need to find at least one component
// for which the subfilters hold true.
- foreach($parent->$filter['name'] as $subComponent) {
+ foreach ($parent->$filter['name'] as $subComponent) {
if (
$this->validateCompFilters($subComponent, $filter['comp-filters']) &&
@@ -126,7 +126,7 @@ class CalendarQueryValidator {
*/
protected function validatePropFilters(VObject\Component $parent, array $filters) {
- foreach($filters as $filter) {
+ foreach ($filters as $filter) {
$isDefined = isset($parent->$filter['name']);
@@ -144,7 +144,7 @@ class CalendarQueryValidator {
}
if ($filter['time-range']) {
- foreach($parent->$filter['name'] as $subComponent) {
+ foreach ($parent->$filter['name'] as $subComponent) {
if ($this->validateTimeRange($subComponent, $filter['time-range']['start'], $filter['time-range']['end'])) {
continue 2;
}
@@ -158,9 +158,9 @@ class CalendarQueryValidator {
// If there are sub-filters, we need to find at least one property
// for which the subfilters hold true.
- foreach($parent->$filter['name'] as $subComponent) {
+ foreach ($parent->$filter['name'] as $subComponent) {
- if(
+ if (
$this->validateParamFilters($subComponent, $filter['param-filters']) &&
(!$filter['text-match'] || $this->validateTextMatch($subComponent, $filter['text-match']))
) {
@@ -196,7 +196,7 @@ class CalendarQueryValidator {
*/
protected function validateParamFilters(VObject\Property $parent, array $filters) {
- foreach($filters as $filter) {
+ foreach ($filters as $filter) {
$isDefined = isset($parent[$filter['name']]);
@@ -219,9 +219,9 @@ class CalendarQueryValidator {
// If there are sub-filters, we need to find at least one parameter
// for which the subfilters hold true.
- foreach($parent[$filter['name']]->getParts() as $paramPart) {
+ foreach ($parent[$filter['name']]->getParts() as $paramPart) {
- if($this->validateTextMatch($paramPart,$filter['text-match'])) {
+ if ($this->validateTextMatch($paramPart, $filter['text-match'])) {
// We had a match, so this param-filter succeeds
continue 2;
}
@@ -282,7 +282,7 @@ class CalendarQueryValidator {
$end = new DateTime('3000-01-01');
}
- switch($component->name) {
+ switch ($component->name) {
case 'VEVENT' :
case 'VTODO' :
@@ -302,7 +302,7 @@ class CalendarQueryValidator {
// Fire up the iterator!
$it = new VObject\Recur\EventIterator($component->parent->parent, (string)$component->parent->UID);
- while($it->valid()) {
+ while ($it->valid()) {
$expandedEvent = $it->getEventObject();
// We need to check from these expanded alarms, which
@@ -310,7 +310,7 @@ class CalendarQueryValidator {
// determine if we can 'give up' expanding events.
$firstAlarm = null;
if ($expandedEvent->VALARM !== null) {
- foreach($expandedEvent->VALARM as $expandedAlarm) {
+ foreach ($expandedEvent->VALARM as $expandedAlarm) {
$effectiveTrigger = $expandedAlarm->getEffectiveTriggerTime();
if ($expandedAlarm->isInTimeRange($start, $end)) {
diff --git a/lib/CalDAV/CalendarRoot.php b/lib/CalDAV/CalendarRoot.php
index 88f7e4e..a610878 100644
--- a/lib/CalDAV/CalendarRoot.php
+++ b/lib/CalDAV/CalendarRoot.php
@@ -40,7 +40,7 @@ class CalendarRoot extends \Sabre\DAVACL\AbstractPrincipalCollection {
* @param Backend\BackendInterface $caldavBackend
* @param string $principalPrefix
*/
- function __construct(PrincipalBackend\BackendInterface $principalBackend,Backend\BackendInterface $caldavBackend, $principalPrefix = 'principals') {
+ function __construct(PrincipalBackend\BackendInterface $principalBackend, Backend\BackendInterface $caldavBackend, $principalPrefix = 'principals') {
parent::__construct($principalBackend, $principalPrefix);
$this->caldavBackend = $caldavBackend;
diff --git a/lib/CalDAV/Exception/InvalidComponentType.php b/lib/CalDAV/Exception/InvalidComponentType.php
index 7042738..18f036d 100644
--- a/lib/CalDAV/Exception/InvalidComponentType.php
+++ b/lib/CalDAV/Exception/InvalidComponentType.php
@@ -27,7 +27,7 @@ class InvalidComponentType extends DAV\Exception\Forbidden {
$doc = $errorNode->ownerDocument;
- $np = $doc->createElementNS(CalDAV\Plugin::NS_CALDAV,'cal:supported-calendar-component');
+ $np = $doc->createElementNS(CalDAV\Plugin::NS_CALDAV, 'cal:supported-calendar-component');
$errorNode->appendChild($np);
}
diff --git a/lib/CalDAV/ICSExportPlugin.php b/lib/CalDAV/ICSExportPlugin.php
index 759b1e7..5bde442 100644
--- a/lib/CalDAV/ICSExportPlugin.php
+++ b/lib/CalDAV/ICSExportPlugin.php
@@ -2,14 +2,13 @@
namespace Sabre\CalDAV;
-use
- DateTimeZone,
- Sabre\DAV,
- Sabre\VObject,
- Sabre\HTTP\RequestInterface,
- Sabre\HTTP\ResponseInterface,
- Sabre\DAV\Exception\BadRequest,
- DateTime;
+use DateTimeZone;
+use Sabre\DAV;
+use Sabre\VObject;
+use Sabre\HTTP\RequestInterface;
+use Sabre\HTTP\ResponseInterface;
+use Sabre\DAV\Exception\BadRequest;
+use DateTime;
/**
* ICS Exporter
@@ -63,10 +62,10 @@ class ICSExportPlugin extends DAV\ServerPlugin {
function initialize(DAV\Server $server) {
$this->server = $server;
- $server->on('method:GET', [$this,'httpGet'], 90);
+ $server->on('method:GET', [$this, 'httpGet'], 90);
$server->on('browserButtonActions', function($path, $node, &$actions) {
if ($node instanceof ICalendar) {
- $actions .= '<a href="' . htmlspecialchars($path, ENT_QUOTES, 'UTF-8'). '?export"><span class="oi" data-glyph="calendar"></span></a>';
+ $actions .= '<a href="' . htmlspecialchars($path, ENT_QUOTES, 'UTF-8') . '?export"><span class="oi" data-glyph="calendar"></span></a>';
}
});
@@ -179,22 +178,22 @@ class ICSExportPlugin extends DAV\ServerPlugin {
// calendarQuery for speed.
$calendarNode = $this->server->tree->getNodeForPath($path);
$queryResult = $calendarNode->calendarQuery([
- 'name' => 'VCALENDAR',
+ 'name' => 'VCALENDAR',
'comp-filters' => [
[
- 'name' => $componentType,
- 'comp-filters' => [],
- 'prop-filters' => [],
+ 'name' => $componentType,
+ 'comp-filters' => [],
+ 'prop-filters' => [],
'is-not-defined' => false,
- 'time-range' => [
+ 'time-range' => [
'start' => $start,
- 'end' => $end,
+ 'end' => $end,
],
],
],
- 'prop-filters' => [],
+ 'prop-filters' => [],
'is-not-defined' => false,
- 'time-range' => null,
+ 'time-range' => null,
]);
// queryResult is just a list of base urls. We need to prefix the
@@ -213,7 +212,7 @@ class ICSExportPlugin extends DAV\ServerPlugin {
}
// Flattening the arrays
- foreach($nodes as $node) {
+ foreach ($nodes as $node) {
if (isset($node[200][$calDataProp])) {
$blobs[$node['href']] = $node[200][$calDataProp];
}
@@ -247,7 +246,7 @@ class ICSExportPlugin extends DAV\ServerPlugin {
$response->setHeader('Content-Type', $format);
- switch($format) {
+ switch ($format) {
case 'text/calendar' :
$mergedCalendar = $mergedCalendar->serialize();
break;
@@ -289,13 +288,13 @@ class ICSExportPlugin extends DAV\ServerPlugin {
$timezones = [];
$objects = [];
- foreach($inputObjects as $href => $inputObject) {
+ foreach ($inputObjects as $href => $inputObject) {
$nodeComp = VObject\Reader::read($inputObject);
- foreach($nodeComp->children() as $child) {
+ foreach ($nodeComp->children() as $child) {
- switch($child->name) {
+ switch ($child->name) {
case 'VEVENT' :
case 'VTODO' :
case 'VJOURNAL' :
@@ -317,8 +316,8 @@ class ICSExportPlugin extends DAV\ServerPlugin {
}
- foreach($timezones as $tz) $calendar->add($tz);
- foreach($objects as $obj) $calendar->add($obj);
+ foreach ($timezones as $tz) $calendar->add($tz);
+ foreach ($objects as $obj) $calendar->add($obj);
return $calendar;
diff --git a/lib/CalDAV/ICalendar.php b/lib/CalDAV/ICalendar.php
index 18ff63c..6d34fbb 100644
--- a/lib/CalDAV/ICalendar.php
+++ b/lib/CalDAV/ICalendar.php
@@ -2,7 +2,6 @@
namespace Sabre\CalDAV;
-use Sabre\DAV;
use Sabre\DAVACL;
/**
diff --git a/lib/CalDAV/ICalendarObject.php b/lib/CalDAV/ICalendarObject.php
index cd5ded4..888b205 100644
--- a/lib/CalDAV/ICalendarObject.php
+++ b/lib/CalDAV/ICalendarObject.php
@@ -1,6 +1,7 @@
<?php
namespace Sabre\CalDAV;
+
use Sabre\DAV;
/**
diff --git a/lib/CalDAV/Notifications/Collection.php b/lib/CalDAV/Notifications/Collection.php
index 45a69ee..945a8fb 100644
--- a/lib/CalDAV/Notifications/Collection.php
+++ b/lib/CalDAV/Notifications/Collection.php
@@ -59,7 +59,7 @@ class Collection extends DAV\Collection implements ICollection, DAVACL\IACL {
$children = [];
$notifications = $this->caldavBackend->getNotificationsForPrincipal($this->principalUri);
- foreach($notifications as $notification) {
+ foreach ($notifications as $notification) {
$children[] = new Node(
$this->caldavBackend,
diff --git a/lib/CalDAV/Notifications/Node.php b/lib/CalDAV/Notifications/Node.php
index c88fcf5..12863c7 100644
--- a/lib/CalDAV/Notifications/Node.php
+++ b/lib/CalDAV/Notifications/Node.php
@@ -13,7 +13,7 @@ use Sabre\DAVACL;
* The signature is mostly identical to that of Sabre\DAV\IFile, but the get() method
* MUST return an xml document that matches the requirements of the
* 'caldav-notifications.txt' spec.
-
+ *
* @copyright Copyright (C) 2007-2015 fruux GmbH (https://fruux.com/).
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
diff --git a/lib/CalDAV/Notifications/Plugin.php b/lib/CalDAV/Notifications/Plugin.php
index 8c84ab6..de742ec 100644
--- a/lib/CalDAV/Notifications/Plugin.php
+++ b/lib/CalDAV/Notifications/Plugin.php
@@ -11,7 +11,6 @@ use Sabre\DAVACL;
use Sabre\HTTP\RequestInterface;
use Sabre\HTTP\ResponseInterface;
-
/**
* Notifications plugin
*
@@ -65,8 +64,8 @@ class Plugin extends ServerPlugin {
function initialize(Server $server) {
$this->server = $server;
- $server->on('method:GET', [$this,'httpGet'], 90);
- $server->on('propFind', [$this,'propFind']);
+ $server->on('method:GET', [$this, 'httpGet'], 90);
+ $server->on('propFind', [$this, 'propFind']);
$server->xml->namespaceMap[self::NS_CALENDARSERVER] = 'cs';
$server->resourceTypeMapping['\\Sabre\\CalDAV\\Notifications\\ICollection'] = '{' . self::NS_CALENDARSERVER . '}notification';
@@ -144,8 +143,8 @@ class Plugin extends ServerPlugin {
$node->getNotificationType()->xmlSerializeFull($writer);
$writer->endElement();
- $response->setHeader('Content-Type','application/xml');
- $response->setHeader('ETag',$node->getETag());
+ $response->setHeader('Content-Type', 'application/xml');
+ $response->setHeader('ETag', $node->getETag());
$response->setStatus(200);
$response->setBody($writer->outputMemory());
diff --git a/lib/CalDAV/Plugin.php b/lib/CalDAV/Plugin.php
index d6b4632..37174d1 100644
--- a/lib/CalDAV/Plugin.php
+++ b/lib/CalDAV/Plugin.php
@@ -2,18 +2,17 @@
namespace Sabre\CalDAV;
-use
- DateTimeZone,
- Sabre\DAV,
- Sabre\DAV\Exception\BadRequest,
- Sabre\DAV\MkCol,
- Sabre\DAV\Xml\Property\Href,
- Sabre\DAVACL,
- Sabre\VObject,
- Sabre\HTTP,
- Sabre\Uri,
- Sabre\HTTP\RequestInterface,
- Sabre\HTTP\ResponseInterface;
+use DateTimeZone;
+use Sabre\DAV;
+use Sabre\DAV\Exception\BadRequest;
+use Sabre\DAV\MkCol;
+use Sabre\DAV\Xml\Property\Href;
+use Sabre\DAVACL;
+use Sabre\VObject;
+use Sabre\HTTP;
+use Sabre\Uri;
+use Sabre\HTTP\RequestInterface;
+use Sabre\HTTP\ResponseInterface;
/**
* CalDAV plugin
@@ -170,13 +169,13 @@ class Plugin extends DAV\ServerPlugin {
$this->server = $server;
- $server->on('method:MKCALENDAR', [$this,'httpMkCalendar']);
- $server->on('report', [$this,'report']);
- $server->on('propFind', [$this,'propFind']);
- $server->on('onHTMLActionsPanel', [$this,'htmlActionsPanel']);
- $server->on('beforeCreateFile', [$this,'beforeCreateFile']);
- $server->on('beforeWriteContent', [$this,'beforeWriteContent']);
- $server->on('afterMethod:GET', [$this,'httpAfterGET']);
+ $server->on('method:MKCALENDAR', [$this, 'httpMkCalendar']);
+ $server->on('report', [$this, 'report']);
+ $server->on('propFind', [$this, 'propFind']);
+ $server->on('onHTMLActionsPanel', [$this, 'htmlActionsPanel']);
+ $server->on('beforeCreateFile', [$this, 'beforeCreateFile']);
+ $server->on('beforeWriteContent', [$this, 'beforeWriteContent']);
+ $server->on('afterMethod:GET', [$this, 'httpAfterGET']);
$server->xml->namespaceMap[self::NS_CALDAV] = 'cal';
$server->xml->namespaceMap[self::NS_CALENDARSERVER] = 'cs';
@@ -227,7 +226,7 @@ class Plugin extends DAV\ServerPlugin {
*/
function report($reportName, $report) {
- switch($reportName) {
+ switch ($reportName) {
case '{' . self::NS_CALDAV . '}calendar-multiget' :
$this->server->transactionType = 'report-calendar-multiget';
$this->calendarMultiGetReport($report);
@@ -290,7 +289,7 @@ class Plugin extends DAV\ServerPlugin {
$this->server->createCollection($path, new MkCol($resourceType, $properties));
$this->server->httpResponse->setStatus(201);
- $this->server->httpResponse->setHeader('Content-Length',0);
+ $this->server->httpResponse->setHeader('Content-Length', 0);
// This breaks the method chain.
return false;
@@ -345,9 +344,9 @@ class Plugin extends DAV\ServerPlugin {
$propFind->handle('{' . self::NS_CALENDARSERVER . '}email-address-set', function() use ($node) {
$addresses = $node->getAlternateUriSet();
$emails = [];
- foreach($addresses as $address) {
- if (substr($address,0,7)==='mailto:') {
- $emails[] = substr($address,7);
+ foreach ($addresses as $address) {
+ if (substr($address, 0, 7) === 'mailto:') {
+ $emails[] = substr($address, 7);
}
}
return new Xml\Property\EmailAddressSet($emails);
@@ -358,14 +357,14 @@ class Plugin extends DAV\ServerPlugin {
$propRead = '{' . self::NS_CALENDARSERVER . '}calendar-proxy-read-for';
$propWrite = '{' . self::NS_CALENDARSERVER . '}calendar-proxy-write-for';
- if ($propFind->getStatus($propRead)===404 || $propFind->getStatus($propWrite)===404) {
+ if ($propFind->getStatus($propRead) === 404 || $propFind->getStatus($propWrite) === 404) {
$aclPlugin = $this->server->getPlugin('acl');
$membership = $aclPlugin->getPrincipalMembership($propFind->getPath());
$readList = [];
$writeList = [];
- foreach($membership as $group) {
+ foreach ($membership as $group) {
$groupNode = $this->server->tree->getNodeForPath($group);
@@ -393,13 +392,13 @@ class Plugin extends DAV\ServerPlugin {
// The calendar-data property is not supposed to be a 'real'
// property, but in large chunks of the spec it does act as such.
// Therefore we simply expose it as a property.
- $propFind->handle( '{' . Plugin::NS_CALDAV . '}calendar-data', function() use ($node) {
+ $propFind->handle('{' . self::NS_CALDAV . '}calendar-data', function() use ($node) {
$val = $node->get();
if (is_resource($val))
$val = stream_get_contents($val);
// Taking out \r to not screw up the xml output
- return str_replace("\r","", $val);
+ return str_replace("\r", "", $val);
});
@@ -423,7 +422,7 @@ class Plugin extends DAV\ServerPlugin {
$timeZones = [];
$propertyList = [];
- foreach($this->server->getPropertiesForMultiplePaths($report->hrefs, $report->properties) as $uri=>$objProps) {
+ foreach ($this->server->getPropertiesForMultiplePaths($report->hrefs, $report->properties) as $uri => $objProps) {
if (($needsJson || $report->expand) && isset($objProps[200]['{' . self::NS_CALDAV . '}calendar-data'])) {
$vObject = VObject\Reader::read($objProps[200]['{' . self::NS_CALDAV . '}calendar-data']);
@@ -457,15 +456,15 @@ class Plugin extends DAV\ServerPlugin {
}
}
- $propertyList[]=$objProps;
+ $propertyList[] = $objProps;
}
$prefer = $this->server->getHTTPPRefer();
$this->server->httpResponse->setStatus(207);
- $this->server->httpResponse->setHeader('Content-Type','application/xml; charset=utf-8');
- $this->server->httpResponse->setHeader('Vary','Brief,Prefer');
+ $this->server->httpResponse->setHeader('Content-Type', 'application/xml; charset=utf-8');
+ $this->server->httpResponse->setHeader('Vary', 'Brief,Prefer');
$this->server->httpResponse->setBody($this->server->generateMultiStatus($propertyList, $prefer['return-minimal']));
}
@@ -543,7 +542,7 @@ class Plugin extends DAV\ServerPlugin {
$validator = new CalendarQueryValidator();
$vObject = VObject\Reader::read($properties[200]['{urn:ietf:params:xml:ns:caldav}calendar-data']);
- if ($validator->validate($vObject,$report->filters)) {
+ if ($validator->validate($vObject, $report->filters)) {
// If the client didn't require the calendar-data property,
// we won't give it back.
@@ -576,7 +575,7 @@ class Plugin extends DAV\ServerPlugin {
$nodePaths = $node->calendarQuery($report->filters);
- foreach($nodePaths as $path) {
+ foreach ($nodePaths as $path) {
list($properties) =
$this->server->getPropertiesForPath($this->server->getRequestUri() . '/' . $path, $report->properties);
@@ -603,8 +602,8 @@ class Plugin extends DAV\ServerPlugin {
$prefer = $this->server->getHTTPPRefer();
$this->server->httpResponse->setStatus(207);
- $this->server->httpResponse->setHeader('Content-Type','application/xml; charset=utf-8');
- $this->server->httpResponse->setHeader('Vary','Brief,Prefer');
+ $this->server->httpResponse->setHeader('Content-Type', 'application/xml; charset=utf-8');
+ $this->server->httpResponse->setHeader('Vary', 'Brief,Prefer');
$this->server->httpResponse->setBody($this->server->generateMultiStatus($result, $prefer['return-minimal']));
}
@@ -622,7 +621,7 @@ class Plugin extends DAV\ServerPlugin {
$acl = $this->server->getPlugin('acl');
if ($acl) {
- $acl->checkPrivileges($uri,'{' . self::NS_CALDAV . '}read-free-busy');
+ $acl->checkPrivileges($uri, '{' . self::NS_CALDAV . '}read-free-busy');
}
$calendar = $this->server->tree->getNodeForPath($uri);
@@ -646,22 +645,22 @@ class Plugin extends DAV\ServerPlugin {
// Doing a calendar-query first, to make sure we get the most
// performance.
$urls = $calendar->calendarQuery([
- 'name' => 'VCALENDAR',
+ 'name' => 'VCALENDAR',
'comp-filters' => [
[
- 'name' => 'VEVENT',
- 'comp-filters' => [],
- 'prop-filters' => [],
+ 'name' => 'VEVENT',
+ 'comp-filters' => [],
+ 'prop-filters' => [],
'is-not-defined' => false,
- 'time-range' => [
+ 'time-range' => [
'start' => $report->start,
- 'end' => $report->end,
+ 'end' => $report->end,
],
],
],
- 'prop-filters' => [],
+ 'prop-filters' => [],
'is-not-defined' => false,
- 'time-range' => null,
+ 'time-range' => null,
]);
$objects = array_map(function($url) use ($calendar) {
@@ -775,13 +774,13 @@ class Plugin extends DAV\ServerPlugin {
// Converting the data to unicode, if needed.
$data = DAV\StringUtil::ensureUTF8($data);
- if ($before!==md5($data)) $modified = true;
+ if ($before !== md5($data)) $modified = true;
try {
// If the data starts with a [, we can reasonably assume we're dealing
// with a jCal object.
- if (substr($data,0,1)==='[') {
+ if (substr($data, 0, 1) === '[') {
$vobj = VObject\Reader::readJson($data);
// Converting $data back to iCalendar, as that's what we
@@ -816,8 +815,8 @@ class Plugin extends DAV\ServerPlugin {
$foundType = null;
$foundUID = null;
- foreach($vobj->getComponents() as $component) {
- switch($component->name) {
+ foreach ($vobj->getComponents() as $component) {
+ switch ($component->name) {
case 'VTIMEZONE' :
continue 2;
case 'VEVENT' :
@@ -895,7 +894,7 @@ class Plugin extends DAV\ServerPlugin {
if (!$node instanceof CalendarHome)
return;
- $output.= '<tr><td colspan="2"><form method="post" action="">
+ $output .= '<tr><td colspan="2"><form method="post" action="">
<h3>Create new calendar</h3>
<input type="hidden" name="sabreAction" value="mkcol" />
<input type="hidden" name="resourceType" value="{DAV:}collection,{' . self::NS_CALDAV . '}calendar" />
@@ -920,7 +919,7 @@ class Plugin extends DAV\ServerPlugin {
*/
function httpAfterGet(RequestInterface $request, ResponseInterface $response) {
- if (strpos($response->getHeader('Content-Type'),'text/calendar')===false) {
+ if (strpos($response->getHeader('Content-Type'), 'text/calendar') === false) {
return;
}
diff --git a/lib/CalDAV/Principal/Collection.php b/lib/CalDAV/Principal/Collection.php
index c850c53..99a0dcf 100644
--- a/lib/CalDAV/Principal/Collection.php
+++ b/lib/CalDAV/Principal/Collection.php
@@ -1,6 +1,7 @@
<?php
namespace Sabre\CalDAV\Principal;
+
use Sabre\DAVACL;
/**
diff --git a/lib/CalDAV/Principal/ProxyRead.php b/lib/CalDAV/Principal/ProxyRead.php
index 45e62ec..b288527 100644
--- a/lib/CalDAV/Principal/ProxyRead.php
+++ b/lib/CalDAV/Principal/ProxyRead.php
@@ -1,6 +1,7 @@
<?php
namespace Sabre\CalDAV\Principal;
+
use Sabre\DAVACL;
use Sabre\DAV;
diff --git a/lib/CalDAV/Principal/ProxyWrite.php b/lib/CalDAV/Principal/ProxyWrite.php
index 58bd64f..5f45554 100644
--- a/lib/CalDAV/Principal/ProxyWrite.php
+++ b/lib/CalDAV/Principal/ProxyWrite.php
@@ -1,6 +1,7 @@
<?php
namespace Sabre\CalDAV\Principal;
+
use Sabre\DAVACL;
use Sabre\DAV;
@@ -103,7 +104,7 @@ class ProxyWrite implements IProxyWrite {
*/
function getAlternateUriSet() {
- return array();
+ return [];
}
diff --git a/lib/CalDAV/Principal/User.php b/lib/CalDAV/Principal/User.php
index 0ae8235..0f44d0b 100644
--- a/lib/CalDAV/Principal/User.php
+++ b/lib/CalDAV/Principal/User.php
@@ -1,6 +1,7 @@
<?php
namespace Sabre\CalDAV\Principal;
+
use Sabre\DAV;
use Sabre\DAVACL;
@@ -69,7 +70,7 @@ class User extends DAVACL\Principal implements DAV\ICollection {
/**
* Returns an array with all the child nodes
*
- * @return DAV\INode[]
+ * @return DAV\INode[]
*/
function getChildren() {
diff --git a/lib/CalDAV/Schedule/IMipPlugin.php b/lib/CalDAV/Schedule/IMipPlugin.php
index 95b4ca6..e53f04a 100644
--- a/lib/CalDAV/Schedule/IMipPlugin.php
+++ b/lib/CalDAV/Schedule/IMipPlugin.php
@@ -3,7 +3,6 @@
namespace Sabre\CalDAV\Schedule;
use Sabre\DAV;
-use Sabre\VObject;
use Sabre\VObject\ITip;
/**
@@ -100,14 +99,14 @@ class IMipPlugin extends DAV\ServerPlugin {
$summary = $iTipMessage->message->VEVENT->SUMMARY;
- if (parse_url($iTipMessage->sender, PHP_URL_SCHEME)!=='mailto')
+ if (parse_url($iTipMessage->sender, PHP_URL_SCHEME) !== 'mailto')
return;
- if (parse_url($iTipMessage->recipient, PHP_URL_SCHEME)!=='mailto')
+ if (parse_url($iTipMessage->recipient, PHP_URL_SCHEME) !== 'mailto')
return;
- $sender = substr($iTipMessage->sender,7);
- $recipient = substr($iTipMessage->recipient,7);
+ $sender = substr($iTipMessage->sender, 7);
+ $recipient = substr($iTipMessage->recipient, 7);
if ($iTipMessage->senderName) {
$sender = $iTipMessage->senderName . ' <' . $sender . '>';
@@ -117,7 +116,7 @@ class IMipPlugin extends DAV\ServerPlugin {
}
$subject = 'SabreDAV iTIP message';
- switch(strtoupper($iTipMessage->method)) {
+ switch (strtoupper($iTipMessage->method)) {
case 'REPLY' :
$subject = 'Re: ' . $summary;
break;
diff --git a/lib/CalDAV/Schedule/Inbox.php b/lib/CalDAV/Schedule/Inbox.php
index eed564a..d6e990c 100644
--- a/lib/CalDAV/Schedule/Inbox.php
+++ b/lib/CalDAV/Schedule/Inbox.php
@@ -2,12 +2,11 @@
namespace Sabre\CalDAV\Schedule;
-use
- Sabre\DAV,
- Sabre\CalDAV,
- Sabre\DAVACL,
- Sabre\CalDAV\Backend,
- Sabre\VObject;
+use Sabre\DAV;
+use Sabre\CalDAV;
+use Sabre\DAVACL;
+use Sabre\CalDAV\Backend;
+use Sabre\VObject;
/**
* The CalDAV scheduling inbox
@@ -66,10 +65,10 @@ class Inbox extends DAV\Collection implements IInbox {
$objs = $this->caldavBackend->getSchedulingObjects($this->principalUri);
$children = [];
- foreach($objs as $obj) {
+ foreach ($objs as $obj) {
//$obj['acl'] = $this->getACL();
$obj['principaluri'] = $this->principalUri;
- $children[] = new SchedulingObject($this->caldavBackend,$obj);
+ $children[] = new SchedulingObject($this->caldavBackend, $obj);
}
return $children;
@@ -222,7 +221,7 @@ class Inbox extends DAV\Collection implements IInbox {
$default = DAVACL\Plugin::getDefaultSupportedPrivilegeSet();
$default['aggregates'][] = [
- 'privilege' => $ns . 'schedule-deliver',
+ 'privilege' => $ns . 'schedule-deliver',
'aggregates' => [
['privilege' => $ns . 'schedule-deliver-invite'],
['privilege' => $ns . 'schedule-deliver-reply'],
@@ -255,7 +254,7 @@ class Inbox extends DAV\Collection implements IInbox {
$validator = new CalDAV\CalendarQueryValidator();
$objects = $this->caldavBackend->getSchedulingObjects($this->principalUri);
- foreach($objects as $object) {
+ foreach ($objects as $object) {
$vObject = VObject\Reader::read($object['calendardata']);
if ($validator->validate($vObject, $filters)) {
$result[] = $object['uri'];
diff --git a/lib/CalDAV/Schedule/Outbox.php b/lib/CalDAV/Schedule/Outbox.php
index 2f3ccc0..b0a9666 100644
--- a/lib/CalDAV/Schedule/Outbox.php
+++ b/lib/CalDAV/Schedule/Outbox.php
@@ -1,6 +1,7 @@
<?php
namespace Sabre\CalDAV\Schedule;
+
use Sabre\DAV;
use Sabre\CalDAV;
use Sabre\DAVACL;
diff --git a/lib/CalDAV/Schedule/Plugin.php b/lib/CalDAV/Schedule/Plugin.php
index d11d2a3..4809f24 100644
--- a/lib/CalDAV/Schedule/Plugin.php
+++ b/lib/CalDAV/Schedule/Plugin.php
@@ -2,28 +2,27 @@
namespace Sabre\CalDAV\Schedule;
-use
- DateTimeZone,
- Sabre\DAV\Server,
- Sabre\DAV\ServerPlugin,
- Sabre\DAV\PropFind,
- Sabre\DAV\INode,
- Sabre\DAV\Xml\Property\Href,
- Sabre\HTTP\RequestInterface,
- Sabre\HTTP\ResponseInterface,
- Sabre\VObject,
- Sabre\VObject\Reader,
- Sabre\VObject\Component\VCalendar,
- Sabre\VObject\ITip,
- Sabre\VObject\ITip\Message,
- Sabre\DAVACL,
- Sabre\CalDAV\ICalendar,
- Sabre\CalDAV\ICalendarObject,
- Sabre\CalDAV\Xml\Property\ScheduleCalendarTransp,
- Sabre\DAV\Exception\NotFound,
- Sabre\DAV\Exception\Forbidden,
- Sabre\DAV\Exception\BadRequest,
- Sabre\DAV\Exception\NotImplemented;
+use DateTimeZone;
+use Sabre\DAV\Server;
+use Sabre\DAV\ServerPlugin;
+use Sabre\DAV\PropFind;
+use Sabre\DAV\INode;
+use Sabre\DAV\Xml\Property\Href;
+use Sabre\HTTP\RequestInterface;
+use Sabre\HTTP\ResponseInterface;
+use Sabre\VObject;
+use Sabre\VObject\Reader;
+use Sabre\VObject\Component\VCalendar;
+use Sabre\VObject\ITip;
+use Sabre\VObject\ITip\Message;
+use Sabre\DAVACL;
+use Sabre\CalDAV\ICalendar;
+use Sabre\CalDAV\ICalendarObject;
+use Sabre\CalDAV\Xml\Property\ScheduleCalendarTransp;
+use Sabre\DAV\Exception\NotFound;
+use Sabre\DAV\Exception\Forbidden;
+use Sabre\DAV\Exception\BadRequest;
+use Sabre\DAV\Exception\NotImplemented;
/**
* CalDAV scheduling plugin.
@@ -164,7 +163,7 @@ class Plugin extends ServerPlugin {
// Checking if this is a text/calendar content type
$contentType = $request->getHeader('Content-Type');
- if (strpos($contentType, 'text/calendar')!==0) {
+ if (strpos($contentType, 'text/calendar') !== 0) {
return;
}
@@ -205,7 +204,7 @@ class Plugin extends ServerPlugin {
$principalUrl = $node->getPrincipalUrl();
// schedule-outbox-URL property
- $propFind->handle('{' . self::NS_CALDAV . '}schedule-outbox-URL' , function() use ($principalUrl, $caldavPlugin) {
+ $propFind->handle('{' . self::NS_CALDAV . '}schedule-outbox-URL', function() use ($principalUrl, $caldavPlugin) {
$calendarHomePath = $caldavPlugin->getCalendarHomeForPrincipal($principalUrl);
$outboxPath = $calendarHomePath . '/outbox/';
@@ -214,7 +213,7 @@ class Plugin extends ServerPlugin {
});
// schedule-inbox-URL property
- $propFind->handle('{' . self::NS_CALDAV . '}schedule-inbox-URL' , function() use ($principalUrl, $caldavPlugin) {
+ $propFind->handle('{' . self::NS_CALDAV . '}schedule-inbox-URL', function() use ($principalUrl, $caldavPlugin) {
$calendarHomePath = $caldavPlugin->getCalendarHomeForPrincipal($principalUrl);
$inboxPath = $calendarHomePath . '/inbox/';
@@ -236,7 +235,7 @@ class Plugin extends ServerPlugin {
$sccs,
], 1);
- foreach($result as $child) {
+ foreach ($result as $child) {
if (!isset($child[200]['{DAV:}resourcetype']) || !$child[200]['{DAV:}resourcetype']->is('{' . self::NS_CALDAV . '}calendar') || $child[200]['{DAV:}resourcetype']->is('{http://calendarserver.org/ns/}shared')) {
// Node is either not a calendar or a shared instance.
continue;
@@ -305,12 +304,12 @@ class Plugin extends ServerPlugin {
$this->server->emit('schedule', [$iTipMessage]);
if (!$iTipMessage->scheduleStatus) {
- $iTipMessage->scheduleStatus='5.2;There was no system capable of delivering the scheduling message';
+ $iTipMessage->scheduleStatus = '5.2;There was no system capable of delivering the scheduling message';
}
// In case the change was considered 'insignificant', we are going to
// remove any error statuses, if any. See ticket #525.
list($baseCode) = explode('.', $iTipMessage->scheduleStatus);
- if (!$iTipMessage->significantChange && in_array($baseCode,['3','5'])) {
+ if (!$iTipMessage->significantChange && in_array($baseCode, ['3', '5'])) {
$iTipMessage->scheduleStatus = null;
}
@@ -329,7 +328,7 @@ class Plugin extends ServerPlugin {
// FIXME: We shouldn't trigger this functionality when we're issuing a
// MOVE. This is a hack.
- if ($this->server->httpRequest->getMethod()==='MOVE') return;
+ if ($this->server->httpRequest->getMethod() === 'MOVE') return;
$node = $this->server->tree->getNodeForPath($path);
@@ -348,7 +347,7 @@ class Plugin extends ServerPlugin {
$broker = new ITip\Broker();
$messages = $broker->parseEvent(null, $addresses, $node->get());
- foreach($messages as $message) {
+ foreach ($messages as $message) {
$this->deliver($message);
}
@@ -372,7 +371,7 @@ class Plugin extends ServerPlugin {
return;
}
- $caldavNS = '{' . Plugin::NS_CALDAV . '}';
+ $caldavNS = '{' . self::NS_CALDAV . '}';
$principalUri = $aclPlugin->getPrincipalByUri($iTipMessage->recipient);
if (!$principalUri) {
@@ -426,7 +425,7 @@ class Plugin extends ServerPlugin {
}
if (!$aclPlugin->checkPrivileges($inboxPath, $caldavNS . $privilege, DAVACL\Plugin::R_PARENT, false)) {
- $iTipMessage->scheduleStatus = '3.8;organizer did not have the '.$privilege.' privilege on the attendees inbox';
+ $iTipMessage->scheduleStatus = '3.8;organizer did not have the ' . $privilege . ' privilege on the attendees inbox';
return;
}
@@ -508,7 +507,7 @@ class Plugin extends ServerPlugin {
* @param VCalendar $newObject
* @param array $addresses
* @param array $ignore Any addresses to not send messages to.
- * @param boolean $modified A marker to indicate that the original object
+ * @param bool $modified A marker to indicate that the original object
* modified by this process.
* @return void
*/
@@ -519,7 +518,7 @@ class Plugin extends ServerPlugin {
if ($messages) $modified = true;
- foreach($messages as $message) {
+ foreach ($messages as $message) {
if (in_array($message->recipient, $ignore)) {
continue;
@@ -535,7 +534,7 @@ class Plugin extends ServerPlugin {
} else {
- if (isset($newObject->VEVENT->ATTENDEE)) foreach($newObject->VEVENT->ATTENDEE as $attendee) {
+ if (isset($newObject->VEVENT->ATTENDEE)) foreach ($newObject->VEVENT->ATTENDEE as $attendee) {
if ($attendee->getNormalizedValue() === $message->recipient) {
if ($message->scheduleStatus) {
@@ -609,7 +608,7 @@ class Plugin extends ServerPlugin {
// component. The combination of both determines what type of request
// this is.
$componentType = null;
- foreach($vObject->getComponents() as $component) {
+ foreach ($vObject->getComponents() as $component) {
if ($component->name !== 'VTIMEZONE') {
$componentType = $component->name;
break;
@@ -678,8 +677,8 @@ class Plugin extends ServerPlugin {
}
$attendees = [];
- foreach($vFreeBusy->ATTENDEE as $attendee) {
- $attendees[]= (string)$attendee;
+ foreach ($vFreeBusy->ATTENDEE as $attendee) {
+ $attendees[] = (string)$attendee;
}
@@ -691,21 +690,21 @@ class Plugin extends ServerPlugin {
$endRange = $vFreeBusy->DTEND->getDateTime();
$results = [];
- foreach($attendees as $attendee) {
+ foreach ($attendees as $attendee) {
$results[] = $this->getFreeBusyForEmail($attendee, $startRange, $endRange, $vObject);
}
- $dom = new \DOMDocument('1.0','utf-8');
+ $dom = new \DOMDocument('1.0', 'utf-8');
$dom->formatOutput = true;
$scheduleResponse = $dom->createElement('cal:schedule-response');
- foreach($this->server->xml->namespaceMap as $namespace=>$prefix) {
+ foreach ($this->server->xml->namespaceMap as $namespace => $prefix) {
- $scheduleResponse->setAttribute('xmlns:' . $prefix,$namespace);
+ $scheduleResponse->setAttribute('xmlns:' . $prefix, $namespace);
}
$dom->appendChild($scheduleResponse);
- foreach($results as $result) {
+ foreach ($results as $result) {
$xresponse = $dom->createElement('cal:response');
$recipient = $dom->createElement('cal:recipient');
@@ -722,7 +721,7 @@ class Plugin extends ServerPlugin {
if (isset($result['calendar-data'])) {
$calendardata = $dom->createElement('cal:calendar-data');
- $calendardata->appendChild($dom->createTextNode(str_replace("\r\n","\n",$result['calendar-data']->serialize())));
+ $calendardata->appendChild($dom->createTextNode(str_replace("\r\n", "\n", $result['calendar-data']->serialize())));
$xresponse->appendChild($calendardata);
}
@@ -730,7 +729,7 @@ class Plugin extends ServerPlugin {
}
$response->setStatus(200);
- $response->setHeader('Content-Type','application/xml');
+ $response->setHeader('Content-Type', 'application/xml');
$response->setBody($dom->saveXML());
}
@@ -755,10 +754,10 @@ class Plugin extends ServerPlugin {
*/
protected function getFreeBusyForEmail($email, \DateTime $start, \DateTime $end, VObject\Component $request) {
- $caldavNS = '{' . Plugin::NS_CALDAV . '}';
+ $caldavNS = '{' . self::NS_CALDAV . '}';
$aclPlugin = $this->server->getPlugin('acl');
- if (substr($email,0,7)==='mailto:') $email = substr($email,7);
+ if (substr($email, 0, 7) === 'mailto:') $email = substr($email, 7);
$result = $aclPlugin->principalSearch(
['{http://sabredav.org/ns}email-address' => $email],
@@ -771,14 +770,14 @@ class Plugin extends ServerPlugin {
if (!count($result)) {
return [
'request-status' => '3.7;Could not find principal',
- 'href' => 'mailto:' . $email,
+ 'href' => 'mailto:' . $email,
];
}
if (!isset($result[0][200][$caldavNS . 'calendar-home-set'])) {
return [
'request-status' => '3.7;No calendar-home-set property found',
- 'href' => 'mailto:' . $email,
+ 'href' => 'mailto:' . $email,
];
}
$homeSet = $result[0][200][$caldavNS . 'calendar-home-set']->getHref();
@@ -787,7 +786,7 @@ class Plugin extends ServerPlugin {
$objects = [];
$calendarTimeZone = new DateTimeZone('UTC');
- foreach($this->server->tree->getNodeForPath($homeSet)->getChildren() as $node) {
+ foreach ($this->server->tree->getNodeForPath($homeSet)->getChildren() as $node) {
if (!$node instanceof ICalendar) {
continue;
}
@@ -802,7 +801,7 @@ class Plugin extends ServerPlugin {
continue;
}
- $aclPlugin->checkPrivileges($homeSet . $node->getName() ,$caldavNS . 'read-free-busy');
+ $aclPlugin->checkPrivileges($homeSet . $node->getName(), $caldavNS . 'read-free-busy');
if (isset($props[$ctz])) {
$vtimezoneObj = VObject\Reader::read($props[$ctz]);
@@ -811,22 +810,22 @@ class Plugin extends ServerPlugin {
// Getting the list of object uris within the time-range
$urls = $node->calendarQuery([
- 'name' => 'VCALENDAR',
+ 'name' => 'VCALENDAR',
'comp-filters' => [
[
- 'name' => 'VEVENT',
- 'comp-filters' => [],
- 'prop-filters' => [],
+ 'name' => 'VEVENT',
+ 'comp-filters' => [],
+ 'prop-filters' => [],
'is-not-defined' => false,
- 'time-range' => [
+ 'time-range' => [
'start' => $start,
- 'end' => $end,
+ 'end' => $end,
],
],
],
- 'prop-filters' => [],
+ 'prop-filters' => [],
'is-not-defined' => false,
- 'time-range' => null,
+ 'time-range' => null,
]);
$calObjects = array_map(function($url) use ($node) {
@@ -834,7 +833,7 @@ class Plugin extends ServerPlugin {
return $obj;
}, $urls);
- $objects = array_merge($objects,$calObjects);
+ $objects = array_merge($objects, $calObjects);
}
@@ -854,9 +853,9 @@ class Plugin extends ServerPlugin {
$vcalendar->VFREEBUSY->ORGANIZER = clone $request->VFREEBUSY->ORGANIZER;
return [
- 'calendar-data' => $result,
+ 'calendar-data' => $result,
'request-status' => '2.0;Success',
- 'href' => 'mailto:' . $email,
+ 'href' => 'mailto:' . $email,
];
}
@@ -870,7 +869,7 @@ class Plugin extends ServerPlugin {
private function scheduleReply(RequestInterface $request) {
$scheduleReply = $request->getHeader('Schedule-Reply');
- return $scheduleReply!=='F';
+ return $scheduleReply !== 'F';
}
diff --git a/lib/CalDAV/Schedule/SchedulingObject.php b/lib/CalDAV/Schedule/SchedulingObject.php
index 7bb9adb..6e09302 100644
--- a/lib/CalDAV/Schedule/SchedulingObject.php
+++ b/lib/CalDAV/Schedule/SchedulingObject.php
@@ -45,7 +45,7 @@ class SchedulingObject extends \Sabre\CalDAV\CalendarObject implements IScheduli
* @param Backend\BackendInterface $caldavBackend
* @param array $objectData
*/
- function __construct(Backend\SchedulingSupport $caldavBackend,array $objectData) {
+ function __construct(Backend\SchedulingSupport $caldavBackend, array $objectData) {
$this->caldavBackend = $caldavBackend;
@@ -92,7 +92,7 @@ class SchedulingObject extends \Sabre\CalDAV\CalendarObject implements IScheduli
*/
function delete() {
- $this->caldavBackend->deleteSchedulingObject($this->objectData['principaluri'],$this->objectData['uri']);
+ $this->caldavBackend->deleteSchedulingObject($this->objectData['principaluri'], $this->objectData['uri']);
}
diff --git a/lib/CalDAV/SharedCalendar.php b/lib/CalDAV/SharedCalendar.php
index 2ada07e..769c70d 100644
--- a/lib/CalDAV/SharedCalendar.php
+++ b/lib/CalDAV/SharedCalendar.php
@@ -24,7 +24,7 @@ class SharedCalendar extends Calendar implements ISharedCalendar {
'{http://sabredav.org/ns}owner-principal',
'{http://sabredav.org/ns}read-only',
];
- foreach($required as $r) {
+ foreach ($required as $r) {
if (!isset($calendarInfo[$r])) {
throw new \InvalidArgumentException('The ' . $r . ' property must be specified for SharedCalendar(s)');
}
diff --git a/lib/CalDAV/SharingPlugin.php b/lib/CalDAV/SharingPlugin.php
index 67123e6..45929d4 100644
--- a/lib/CalDAV/SharingPlugin.php
+++ b/lib/CalDAV/SharingPlugin.php
@@ -95,8 +95,8 @@ class SharingPlugin extends DAV\ServerPlugin {
$this->server->xml->elementMap['{' . Plugin::NS_CALENDARSERVER . '}share'] = 'Sabre\\CalDAV\\Xml\\Request\\Share';
$this->server->xml->elementMap['{' . Plugin::NS_CALENDARSERVER . '}invite-reply'] = 'Sabre\\CalDAV\\Xml\\Request\\InviteReply';
- $this->server->on('propFind', [$this,'propFindEarly']);
- $this->server->on('propFind', [$this,'propFindLate'], 150);
+ $this->server->on('propFind', [$this, 'propFindEarly']);
+ $this->server->on('propFind', [$this, 'propFindLate'], 150);
$this->server->on('propPatch', [$this, 'propPatch'], 40);
$this->server->on('method:POST', [$this, 'httpPost']);
@@ -186,7 +186,7 @@ class SharingPlugin extends DAV\ServerPlugin {
}
}
$propFind->handle('{' . Plugin::NS_CALENDARSERVER . '}allowed-sharing-modes', function() {
- return new Xml\Property\AllowedSharingModes(true,false);
+ return new Xml\Property\AllowedSharingModes(true, false);
});
}
@@ -215,10 +215,10 @@ class SharingPlugin extends DAV\ServerPlugin {
return;
$propPatch->handle('{DAV:}resourcetype', function($value) use ($node) {
- if($value->is('{' . Plugin::NS_CALENDARSERVER . '}shared-owner')) return false;
+ if ($value->is('{' . Plugin::NS_CALENDARSERVER . '}shared-owner')) return false;
$shares = $node->getShares();
$remove = [];
- foreach($shares as $share) {
+ foreach ($shares as $share) {
$remove[] = $share['href'];
}
$node->updateShares([], $remove);
@@ -242,7 +242,7 @@ class SharingPlugin extends DAV\ServerPlugin {
// Only handling xml
$contentType = $request->getHeader('Content-Type');
- if (strpos($contentType,'application/xml')===false && strpos($contentType,'text/xml')===false)
+ if (strpos($contentType, 'application/xml') === false && strpos($contentType, 'text/xml') === false)
return;
// Making sure the node exists
@@ -265,7 +265,7 @@ class SharingPlugin extends DAV\ServerPlugin {
$message = $this->server->xml->parse($requestBody, $request->getUrl(), $documentType);
- switch($documentType) {
+ switch ($documentType) {
// Dealing with the 'share' document, which modified invitees on a
// calendar.
@@ -298,7 +298,7 @@ class SharingPlugin extends DAV\ServerPlugin {
// The invite-reply document is sent when the user replies to an
// invitation of a calendar share.
- case '{'. Plugin::NS_CALENDARSERVER.'}invite-reply' :
+ case '{' . Plugin::NS_CALENDARSERVER . '}invite-reply' :
// This only works on the calendar-home-root node.
if (!$node instanceof CalendarHome) {
@@ -334,7 +334,7 @@ class SharingPlugin extends DAV\ServerPlugin {
$writer->startElement('{' . Plugin::NS_CALENDARSERVER . '}shared-as');
$writer->write(new Href($url));
$writer->endElement();
- $response->setHeader('Content-Type','application/xml');
+ $response->setHeader('Content-Type', 'application/xml');
$response->setBody($writer->outputMemory());
}
diff --git a/lib/CalDAV/Subscriptions/Plugin.php b/lib/CalDAV/Subscriptions/Plugin.php
index 2372f99..1de6ed8 100644
--- a/lib/CalDAV/Subscriptions/Plugin.php
+++ b/lib/CalDAV/Subscriptions/Plugin.php
@@ -2,11 +2,10 @@
namespace Sabre\CalDAV\Subscriptions;
-use
- Sabre\DAV\INode,
- Sabre\DAV\PropFind,
- Sabre\DAV\ServerPlugin,
- Sabre\DAV\Server;
+use Sabre\DAV\INode;
+use Sabre\DAV\PropFind;
+use Sabre\DAV\ServerPlugin;
+use Sabre\DAV\Server;
/**
* This plugin adds calendar-subscription support to your CalDAV server.
@@ -72,9 +71,9 @@ class Plugin extends ServerPlugin {
'{http://calendarserver.org/ns/}subscribed-strip-todos',
];
- foreach($props as $prop) {
+ foreach ($props as $prop) {
- if ($propFind->getStatus($prop)===200) {
+ if ($propFind->getStatus($prop) === 200) {
$propFind->set($prop, '', 200);
}
diff --git a/lib/CalDAV/Subscriptions/Subscription.php b/lib/CalDAV/Subscriptions/Subscription.php
index 562aa4a..0d3d3b1 100644
--- a/lib/CalDAV/Subscriptions/Subscription.php
+++ b/lib/CalDAV/Subscriptions/Subscription.php
@@ -2,15 +2,12 @@
namespace Sabre\CalDAV\Subscriptions;
-use
- Sabre\DAV\Collection,
- Sabre\DAV\Xml\Property\Href,
- Sabre\DAV\PropPatch,
- Sabre\DAV\Exception\MethodNotAllowed,
- Sabre\DAVACL\IACL,
- Sabre\CalDAV\Backend\SubscriptionSupport;
-
-
+use Sabre\DAV\Collection;
+use Sabre\DAV\Xml\Property\Href;
+use Sabre\DAV\PropPatch;
+use Sabre\DAV\Exception\MethodNotAllowed;
+use Sabre\DAVACL\IACL;
+use Sabre\CalDAV\Backend\SubscriptionSupport;
/**
* Subscription Node
@@ -55,7 +52,7 @@ class Subscription extends Collection implements ISubscription, IACL {
'source',
];
- foreach($required as $r) {
+ foreach ($required as $r) {
if (!isset($subscriptionInfo[$r])) {
throw new \InvalidArgumentException('The ' . $r . ' field is required when creating a subscription node');
}
@@ -153,14 +150,14 @@ class Subscription extends Collection implements ISubscription, IACL {
$r = [];
- foreach($properties as $prop) {
+ foreach ($properties as $prop) {
- switch($prop) {
+ switch ($prop) {
case '{http://calendarserver.org/ns/}source' :
$r[$prop] = new Href($this->subscriptionInfo['source'], false);
break;
default :
- if (array_key_exists($prop,$this->subscriptionInfo)) {
+ if (array_key_exists($prop, $this->subscriptionInfo)) {
$r[$prop] = $this->subscriptionInfo[$prop];
}
break;
diff --git a/lib/CalDAV/Xml/Filter/CalendarData.php b/lib/CalDAV/Xml/Filter/CalendarData.php
index 438778e..b23e909 100644
--- a/lib/CalDAV/Xml/Filter/CalendarData.php
+++ b/lib/CalDAV/Xml/Filter/CalendarData.php
@@ -8,7 +8,6 @@ use Sabre\DAV\Exception\BadRequest;
use Sabre\CalDAV\Plugin;
use Sabre\VObject\DateTimeParser;
-
/**
* CalendarData parser.
*
@@ -20,7 +19,7 @@ use Sabre\VObject\DateTimeParser;
* This element is used in three distinct places in the caldav spec, but in
* this case, this element class only implements the calendar-data element as
* it appears in a DAV:prop element, in a calendar-query or calendar-multiget
- * REPORT request.
+ * REPORT request.
*
* @copyright Copyright (C) 2007-2015 fruux GmbH (https://fruux.com/).
* @author Evert Pot (http://www.rooftopsolutions.nl/)
@@ -52,19 +51,19 @@ class CalendarData implements XmlDeserializable {
static function xmlDeserialize(Reader $reader) {
$result = [
- 'contentType' => $reader->getAttribute('content-type')?:'text/calendar',
- 'version' => $reader->getAttribute('version')?:'2.0',
+ 'contentType' => $reader->getAttribute('content-type') ?: 'text/calendar',
+ 'version' => $reader->getAttribute('version') ?: '2.0',
];
$elems = (array)$reader->parseInnerTree();
- foreach($elems as $elem) {
+ foreach ($elems as $elem) {
- switch($elem['name']) {
+ switch ($elem['name']) {
case '{' . Plugin::NS_CALDAV . '}expand' :
$result['expand'] = [
- 'start' => isset($elem['attributes']['start'])?DateTimeParser::parseDateTime($elem['attributes']['start']):null,
- 'end' => isset($elem['attributes']['end'])?DateTimeParser::parseDateTime($elem['attributes']['end']):null,
+ 'start' => isset($elem['attributes']['start']) ? DateTimeParser::parseDateTime($elem['attributes']['start']) : null,
+ 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null,
];
if (!$result['expand']['start'] || !$result['expand']['end']) {
diff --git a/lib/CalDAV/Xml/Filter/CompFilter.php b/lib/CalDAV/Xml/Filter/CompFilter.php
index 1300268..006fe74 100644
--- a/lib/CalDAV/Xml/Filter/CompFilter.php
+++ b/lib/CalDAV/Xml/Filter/CompFilter.php
@@ -2,14 +2,12 @@
namespace Sabre\CalDAV\Xml\Filter;
-
use Sabre\Xml\Reader;
use Sabre\Xml\XmlDeserializable;
use Sabre\DAV\Exception\BadRequest;
use Sabre\CalDAV\Plugin;
use Sabre\VObject\DateTimeParser;
-
/**
* CompFilter parser.
*
@@ -50,11 +48,11 @@ class CompFilter implements XmlDeserializable {
static function xmlDeserialize(Reader $reader) {
$result = [
- 'name' => null,
+ 'name' => null,
'is-not-defined' => false,
- 'comp-filters' => [],
- 'prop-filters' => [],
- 'time-range' => false,
+ 'comp-filters' => [],
+ 'prop-filters' => [],
+ 'time-range' => false,
];
$att = $reader->parseAttributes();
@@ -62,9 +60,9 @@ class CompFilter implements XmlDeserializable {
$elems = $reader->parseInnerTree();
- if (is_array($elems)) foreach($elems as $elem) {
+ if (is_array($elems)) foreach ($elems as $elem) {
- switch($elem['name']) {
+ switch ($elem['name']) {
case '{' . Plugin::NS_CALDAV . '}comp-filter' :
$result['comp-filters'][] = $elem['value'];
@@ -80,10 +78,10 @@ class CompFilter implements XmlDeserializable {
throw new BadRequest('You cannot add time-range filters on the VCALENDAR component');
}
$result['time-range'] = [
- 'start' => isset($elem['attributes']['start'])?DateTimeParser::parseDateTime($elem['attributes']['start']):null,
- 'end' => isset($elem['attributes']['end'])?DateTimeParser::parseDateTime($elem['attributes']['end']):null,
+ 'start' => isset($elem['attributes']['start']) ? DateTimeParser::parseDateTime($elem['attributes']['start']) : null,
+ 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null,
];
- if($result['time-range']['start'] && $result['time-range']['end'] && $result['time-range']['end'] <= $result['time-range']['start']) {
+ if ($result['time-range']['start'] && $result['time-range']['end'] && $result['time-range']['end'] <= $result['time-range']['start']) {
throw new BadRequest('The end-date must be larger than the start-date');
}
break;
diff --git a/lib/CalDAV/Xml/Filter/ParamFilter.php b/lib/CalDAV/Xml/Filter/ParamFilter.php
index 060bfd4..d80f3b6 100644
--- a/lib/CalDAV/Xml/Filter/ParamFilter.php
+++ b/lib/CalDAV/Xml/Filter/ParamFilter.php
@@ -6,7 +6,6 @@ use Sabre\Xml\Reader;
use Sabre\Xml\XmlDeserializable;
use Sabre\CalDAV\Plugin;
-
/**
* PropFilter parser.
*
@@ -47,9 +46,9 @@ class ParamFilter implements XmlDeserializable {
static function xmlDeserialize(Reader $reader) {
$result = [
- 'name' => null,
+ 'name' => null,
'is-not-defined' => false,
- 'text-match' => null,
+ 'text-match' => null,
];
$att = $reader->parseAttributes();
@@ -57,17 +56,17 @@ class ParamFilter implements XmlDeserializable {
$elems = $reader->parseInnerTree();
- if (is_array($elems)) foreach($elems as $elem) {
+ if (is_array($elems)) foreach ($elems as $elem) {
- switch($elem['name']) {
+ switch ($elem['name']) {
case '{' . Plugin::NS_CALDAV . '}is-not-defined' :
$result['is-not-defined'] = true;
break;
case '{' . Plugin::NS_CALDAV . '}text-match' :
$result['text-match'] = [
- 'negate-condition' => isset($elem['attributes']['negate-condition']) && $elem['attributes']['negate-condition']==='yes',
- 'collation' => isset($elem['attributes']['collation'])?$elem['attributes']['collation']:'i;ascii-casemap',
+ 'negate-condition' => isset($elem['attributes']['negate-condition']) && $elem['attributes']['negate-condition'] === 'yes',
+ 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;ascii-casemap',
'value' => $elem['value'],
];
break;
diff --git a/lib/CalDAV/Xml/Filter/PropFilter.php b/lib/CalDAV/Xml/Filter/PropFilter.php
index 4b472ff..ec042da 100644
--- a/lib/CalDAV/Xml/Filter/PropFilter.php
+++ b/lib/CalDAV/Xml/Filter/PropFilter.php
@@ -48,11 +48,11 @@ class PropFilter implements XmlDeserializable {
static function xmlDeserialize(Reader $reader) {
$result = [
- 'name' => null,
+ 'name' => null,
'is-not-defined' => false,
- 'param-filters' => [],
- 'text-match' => null,
- 'time-range' => false,
+ 'param-filters' => [],
+ 'text-match' => null,
+ 'time-range' => false,
];
$att = $reader->parseAttributes();
@@ -60,9 +60,9 @@ class PropFilter implements XmlDeserializable {
$elems = $reader->parseInnerTree();
- if (is_array($elems)) foreach($elems as $elem) {
+ if (is_array($elems)) foreach ($elems as $elem) {
- switch($elem['name']) {
+ switch ($elem['name']) {
case '{' . Plugin::NS_CALDAV . '}param-filter' :
$result['param-filters'][] = $elem['value'];
@@ -72,17 +72,17 @@ class PropFilter implements XmlDeserializable {
break;
case '{' . Plugin::NS_CALDAV . '}time-range' :
$result['time-range'] = [
- 'start' => isset($elem['attributes']['start'])?DateTimeParser::parseDateTime($elem['attributes']['start']):null,
- 'end' => isset($elem['attributes']['end'])?DateTimeParser::parseDateTime($elem['attributes']['end']):null,
+ 'start' => isset($elem['attributes']['start']) ? DateTimeParser::parseDateTime($elem['attributes']['start']) : null,
+ 'end' => isset($elem['attributes']['end']) ? DateTimeParser::parseDateTime($elem['attributes']['end']) : null,
];
- if($result['time-range']['start'] && $result['time-range']['end'] && $result['time-range']['end'] <= $result['time-range']['start']) {
+ if ($result['time-range']['start'] && $result['time-range']['end'] && $result['time-range']['end'] <= $result['time-range']['start']) {
throw new BadRequest('The end-date must be larger than the start-date');
}
break;
case '{' . Plugin::NS_CALDAV . '}text-match' :
$result['text-match'] = [
- 'negate-condition' => isset($elem['attributes']['negate-condition']) && $elem['attributes']['negate-condition']==='yes',
- 'collation' => isset($elem['attributes']['collation'])?$elem['attributes']['collation']:'i;ascii-casemap',
+ 'negate-condition' => isset($elem['attributes']['negate-condition']) && $elem['attributes']['negate-condition'] === 'yes',
+ 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;ascii-casemap',
'value' => $elem['value'],
];
break;
diff --git a/lib/CalDAV/Xml/Notification/Invite.php b/lib/CalDAV/Xml/Notification/Invite.php
index d412813..8811a33 100644
--- a/lib/CalDAV/Xml/Notification/Invite.php
+++ b/lib/CalDAV/Xml/Notification/Invite.php
@@ -139,7 +139,7 @@ class Invite implements NotificationInterface {
*/
function __construct(array $values) {
- $required = array(
+ $required = [
'id',
'etag',
'href',
@@ -148,14 +148,14 @@ class Invite implements NotificationInterface {
'readOnly',
'hostUrl',
'organizer',
- );
- foreach($required as $item) {
+ ];
+ foreach ($required as $item) {
if (!isset($values[$item])) {
throw new \InvalidArgumentException($item . ' is a required constructor option');
}
}
- foreach($values as $key=>$value) {
+ foreach ($values as $key => $value) {
if (!property_exists($this, $key)) {
throw new \InvalidArgumentException('Unknown option: ' . $key);
}
@@ -185,7 +185,7 @@ class Invite implements NotificationInterface {
*/
function xmlSerialize(Writer $writer) {
- $writer->writeElement('{' . CalDAV\Plugin::NS_CALENDARSERVER .'}invite-notification');
+ $writer->writeElement('{' . CalDAV\Plugin::NS_CALENDARSERVER . '}invite-notification');
}
@@ -208,7 +208,7 @@ class Invite implements NotificationInterface {
$writer->writeElement($cs . 'uid', $this->id);
$writer->writeElement('{DAV:}href', $this->href);
- switch($this->type) {
+ switch ($this->type) {
case SharingPlugin::STATUS_ACCEPTED :
$writer->writeElement($cs . 'invite-accepted');
@@ -244,10 +244,10 @@ class Invite implements NotificationInterface {
$writer->startElement($cs . 'organizer');
// If the organizer contains a 'mailto:' part, it means it should be
// treated as absolute.
- if (strtolower(substr($this->organizer,0,7))==='mailto:') {
- $writer->writeElement('{DAV:}href',$this->organizer);
+ if (strtolower(substr($this->organizer, 0, 7)) === 'mailto:') {
+ $writer->writeElement('{DAV:}href', $this->organizer);
} else {
- $writer->writeElement('{DAV:}href',$writer->baseUri . $this->organizer);
+ $writer->writeElement('{DAV:}href', $writer->baseUri . $this->organizer);
}
if ($this->commonName) {
$writer->writeElement($cs . 'common-name', $this->commonName);
diff --git a/lib/CalDAV/Xml/Notification/InviteReply.php b/lib/CalDAV/Xml/Notification/InviteReply.php
index b29702a..08032f3 100644
--- a/lib/CalDAV/Xml/Notification/InviteReply.php
+++ b/lib/CalDAV/Xml/Notification/InviteReply.php
@@ -98,13 +98,13 @@ class InviteReply implements NotificationInterface {
'type',
'hostUrl',
];
- foreach($required as $item) {
+ foreach ($required as $item) {
if (!isset($values[$item])) {
throw new \InvalidArgumentException($item . ' is a required constructor option');
}
}
- foreach($values as $key=>$value) {
+ foreach ($values as $key => $value) {
if (!property_exists($this, $key)) {
throw new \InvalidArgumentException('Unknown option: ' . $key);
}
@@ -134,7 +134,7 @@ class InviteReply implements NotificationInterface {
*/
function xmlSerialize(Writer $writer) {
- $writer->writeElement('{' . CalDAV\Plugin::NS_CALENDARSERVER .'}invite-reply');
+ $writer->writeElement('{' . CalDAV\Plugin::NS_CALENDARSERVER . '}invite-reply');
}
@@ -158,7 +158,7 @@ class InviteReply implements NotificationInterface {
$writer->writeElement($cs . 'in-reply-to', $this->inReplyTo);
$writer->writeElement('{DAV:}href', $this->href);
- switch($this->type) {
+ switch ($this->type) {
case SharingPlugin::STATUS_ACCEPTED :
$writer->writeElement($cs . 'invite-accepted');
diff --git a/lib/CalDAV/Xml/Notification/SystemStatus.php b/lib/CalDAV/Xml/Notification/SystemStatus.php
index 4fb69a5..88c1f16 100644
--- a/lib/CalDAV/Xml/Notification/SystemStatus.php
+++ b/lib/CalDAV/Xml/Notification/SystemStatus.php
@@ -2,9 +2,8 @@
namespace Sabre\CalDAV\Xml\Notification;
-use
- Sabre\Xml\Writer,
- Sabre\CalDAV\Plugin;
+use Sabre\Xml\Writer;
+use Sabre\CalDAV\Plugin;
/**
* SystemStatus notification
@@ -96,7 +95,7 @@ class SystemStatus implements NotificationInterface {
*/
function xmlSerialize(Writer $writer) {
- switch($this->type) {
+ switch ($this->type) {
case self::TYPE_LOW :
$type = 'low';
break;
@@ -109,7 +108,7 @@ class SystemStatus implements NotificationInterface {
break;
}
- $writer->startElement('{' . Plugin::NS_CALENDARSERVER .'}systemstatus');
+ $writer->startElement('{' . Plugin::NS_CALENDARSERVER . '}systemstatus');
$writer->writeAttribute('type', $type);
$writer->endElement();
@@ -124,8 +123,8 @@ class SystemStatus implements NotificationInterface {
*/
function xmlSerializeFull(Writer $writer) {
- $cs = '{' . Plugin::NS_CALENDARSERVER .'}';
- switch($this->type) {
+ $cs = '{' . Plugin::NS_CALENDARSERVER . '}';
+ switch ($this->type) {
case self::TYPE_LOW :
$type = 'low';
break;
@@ -138,7 +137,7 @@ class SystemStatus implements NotificationInterface {
break;
}
- $writer->startElement($cs .'systemstatus');
+ $writer->startElement($cs . 'systemstatus');
$writer->writeAttribute('type', $type);
diff --git a/lib/CalDAV/Xml/Property/EmailAddressSet.php b/lib/CalDAV/Xml/Property/EmailAddressSet.php
index 477afce..4eb157a 100644
--- a/lib/CalDAV/Xml/Property/EmailAddressSet.php
+++ b/lib/CalDAV/Xml/Property/EmailAddressSet.php
@@ -69,7 +69,7 @@ class EmailAddressSet implements XmlSerializable {
*/
function xmlSerialize(Writer $writer) {
- foreach($this->emails as $email) {
+ foreach ($this->emails as $email) {
$writer->writeElement('{http://calendarserver.org/ns/}email-address', $email);
diff --git a/lib/CalDAV/Xml/Property/Invite.php b/lib/CalDAV/Xml/Property/Invite.php
index 468b419..7a0cb77 100644
--- a/lib/CalDAV/Xml/Property/Invite.php
+++ b/lib/CalDAV/Xml/Property/Invite.php
@@ -122,14 +122,14 @@ class Invite implements Element {
}
- foreach($this->users as $user) {
+ foreach ($this->users as $user) {
$writer->startElement($cs . 'user');
$writer->writeElement('{DAV:}href', $user['href']);
if (isset($user['commonName']) && $user['commonName']) {
$writer->writeElement($cs . 'common-name', $user['commonName']);
}
- switch($user['status']) {
+ switch ($user['status']) {
case SharingPlugin::STATUS_ACCEPTED :
$writer->writeElement($cs . 'invite-accepted');
@@ -190,22 +190,22 @@ class Invite implements Element {
$users = [];
- foreach($reader->parseInnerTree() as $elem) {
+ foreach ($reader->parseInnerTree() as $elem) {
- if ($elem['name']!==$cs.'user')
+ if ($elem['name'] !== $cs . 'user')
continue;
$user = [
- 'href' => null,
+ 'href' => null,
'commonName' => null,
- 'readOnly' => null,
- 'summary' => null,
- 'status' => null,
+ 'readOnly' => null,
+ 'summary' => null,
+ 'status' => null,
];
- foreach($elem['value'] as $userElem) {
+ foreach ($elem['value'] as $userElem) {
- switch($userElem['name']) {
+ switch ($userElem['name']) {
case $cs . 'invite-accepted' :
$user['status'] = SharingPlugin::STATUS_ACCEPTED;
break;
@@ -225,7 +225,7 @@ class Invite implements Element {
$user['commonName'] = $userElem['value'];
break;
case $cs . 'access' :
- foreach($userElem['value'] as $accessHref) {
+ foreach ($userElem['value'] as $accessHref) {
if ($accessHref['name'] === $cs . 'read') {
$user['readOnly'] = true;
}
diff --git a/lib/CalDAV/Xml/Property/ScheduleCalendarTransp.php b/lib/CalDAV/Xml/Property/ScheduleCalendarTransp.php
index d7de308..c8014bf 100644
--- a/lib/CalDAV/Xml/Property/ScheduleCalendarTransp.php
+++ b/lib/CalDAV/Xml/Property/ScheduleCalendarTransp.php
@@ -82,12 +82,12 @@ class ScheduleCalendarTransp implements Element {
*/
function xmlSerialize(Writer $writer) {
- switch($this->value) {
+ switch ($this->value) {
case self::TRANSPARENT :
- $writer->writeElement('{'.Plugin::NS_CALDAV.'}transparent');
+ $writer->writeElement('{' . Plugin::NS_CALDAV . '}transparent');
break;
case self::OPAQUE :
- $writer->writeElement('{'.Plugin::NS_CALDAV.'}opaque');
+ $writer->writeElement('{' . Plugin::NS_CALDAV . '}opaque');
break;
}
@@ -120,8 +120,8 @@ class ScheduleCalendarTransp implements Element {
$value = null;
- foreach($elems as $elem) {
- switch($elem) {
+ foreach ($elems as $elem) {
+ switch ($elem) {
case '{' . Plugin::NS_CALDAV . '}opaque' :
$value = self::OPAQUE;
break;
diff --git a/lib/CalDAV/Xml/Property/SupportedCalendarComponentSet.php b/lib/CalDAV/Xml/Property/SupportedCalendarComponentSet.php
index 24a37cc..58c4c3d 100644
--- a/lib/CalDAV/Xml/Property/SupportedCalendarComponentSet.php
+++ b/lib/CalDAV/Xml/Property/SupportedCalendarComponentSet.php
@@ -74,7 +74,7 @@ class SupportedCalendarComponentSet implements Element {
*/
function xmlSerialize(Writer $writer) {
- foreach($this->components as $component) {
+ foreach ($this->components as $component) {
$writer->startElement('{' . Plugin::NS_CALDAV . '}comp');
$writer->writeAttributes(['name' => $component]);
@@ -111,8 +111,8 @@ class SupportedCalendarComponentSet implements Element {
$components = [];
- foreach($elems as $elem) {
- if ($elem['name'] === '{'.Plugin::NS_CALDAV . '}comp') {
+ foreach ($elems as $elem) {
+ if ($elem['name'] === '{' . Plugin::NS_CALDAV . '}comp') {
$components[] = $elem['attributes']['name'];
}
}
diff --git a/lib/CalDAV/Xml/Property/SupportedCalendarData.php b/lib/CalDAV/Xml/Property/SupportedCalendarData.php
index 7ed4add..37e039f 100644
--- a/lib/CalDAV/Xml/Property/SupportedCalendarData.php
+++ b/lib/CalDAV/Xml/Property/SupportedCalendarData.php
@@ -2,10 +2,9 @@
namespace Sabre\CalDAV\Xml\Property;
-use
- Sabre\Xml\XmlSerializable,
- Sabre\Xml\Writer,
- Sabre\CalDAV\Plugin;
+use Sabre\Xml\XmlSerializable;
+use Sabre\Xml\Writer;
+use Sabre\CalDAV\Plugin;
/**
* Supported-calendar-data property
@@ -47,7 +46,7 @@ class SupportedCalendarData implements XmlSerializable {
$writer->startElement('{' . Plugin::NS_CALDAV . '}calendar-data');
$writer->writeAttributes([
'content-type' => 'text/calendar',
- 'version' => '2.0',
+ 'version' => '2.0',
]);
$writer->endElement(); // calendar-data
$writer->startElement('{' . Plugin::NS_CALDAV . '}calendar-data');
diff --git a/lib/CalDAV/Xml/Property/SupportedCollationSet.php b/lib/CalDAV/Xml/Property/SupportedCollationSet.php
index a683f76..60eda4e 100644
--- a/lib/CalDAV/Xml/Property/SupportedCollationSet.php
+++ b/lib/CalDAV/Xml/Property/SupportedCollationSet.php
@@ -48,7 +48,7 @@ class SupportedCollationSet implements XmlSerializable {
'i;unicode-casemap'
];
- foreach($collations as $collation) {
+ foreach ($collations as $collation) {
$writer->writeElement('{' . Plugin::NS_CALDAV . '}supported-collation', $collation);
}
diff --git a/lib/CalDAV/Xml/Request/CalendarMultiGetReport.php b/lib/CalDAV/Xml/Request/CalendarMultiGetReport.php
index cc5bbbd..ed3e93a 100644
--- a/lib/CalDAV/Xml/Request/CalendarMultiGetReport.php
+++ b/lib/CalDAV/Xml/Request/CalendarMultiGetReport.php
@@ -90,18 +90,18 @@ class CalendarMultiGetReport implements XmlDeserializable {
]);
$newProps = [
- 'hrefs' => [],
+ 'hrefs' => [],
'properties' => [],
];
- foreach($elems as $elem) {
+ foreach ($elems as $elem) {
- switch($elem['name']) {
+ switch ($elem['name']) {
case '{DAV:}prop' :
$newProps['properties'] = array_keys($elem['value']);
if (isset($elem['value']['{' . Plugin::NS_CALDAV . '}calendar-data'])) {
- $newProps+=$elem['value']['{' . Plugin::NS_CALDAV . '}calendar-data'];
+ $newProps += $elem['value']['{' . Plugin::NS_CALDAV . '}calendar-data'];
}
break;
case '{DAV:}href' :
@@ -113,7 +113,7 @@ class CalendarMultiGetReport implements XmlDeserializable {
}
$obj = new self();
- foreach($newProps as $key=>$value) {
+ foreach ($newProps as $key => $value) {
$obj->$key = $value;
}
diff --git a/lib/CalDAV/Xml/Request/CalendarQueryReport.php b/lib/CalDAV/Xml/Request/CalendarQueryReport.php
index d808683..3d7ddfb 100644
--- a/lib/CalDAV/Xml/Request/CalendarQueryReport.php
+++ b/lib/CalDAV/Xml/Request/CalendarQueryReport.php
@@ -93,24 +93,24 @@ class CalendarQueryReport implements XmlDeserializable {
]);
$newProps = [
- 'filters' => null,
+ 'filters' => null,
'properties' => [],
];
if (!is_array($elems)) $elems = [];
- foreach($elems as $elem) {
+ foreach ($elems as $elem) {
- switch($elem['name']) {
+ switch ($elem['name']) {
case '{DAV:}prop' :
$newProps['properties'] = array_keys($elem['value']);
if (isset($elem['value']['{' . Plugin::NS_CALDAV . '}calendar-data'])) {
- $newProps+=$elem['value']['{' . Plugin::NS_CALDAV . '}calendar-data'];
+ $newProps += $elem['value']['{' . Plugin::NS_CALDAV . '}calendar-data'];
}
break;
- case '{'.Plugin::NS_CALDAV.'}filter' :
- foreach($elem['value'] as $subElem) {
+ case '{' . Plugin::NS_CALDAV . '}filter' :
+ foreach ($elem['value'] as $subElem) {
if ($subElem['name'] === '{' . Plugin::NS_CALDAV . '}comp-filter') {
if (!is_null($newProps['filters'])) {
throw new BadRequest('Only one top-level comp-filter may be defined');
@@ -129,7 +129,7 @@ class CalendarQueryReport implements XmlDeserializable {
}
$obj = new self();
- foreach($newProps as $key=>$value) {
+ foreach ($newProps as $key => $value) {
$obj->$key = $value;
}
return $obj;
diff --git a/lib/CalDAV/Xml/Request/FreeBusyQueryReport.php b/lib/CalDAV/Xml/Request/FreeBusyQueryReport.php
index d50570e..0e0c52f 100644
--- a/lib/CalDAV/Xml/Request/FreeBusyQueryReport.php
+++ b/lib/CalDAV/Xml/Request/FreeBusyQueryReport.php
@@ -63,12 +63,12 @@ class FreeBusyQueryReport implements XmlDeserializable {
$start = null;
$end = null;
- foreach((array)$reader->parseInnerTree([]) as $elem) {
+ foreach ((array)$reader->parseInnerTree([]) as $elem) {
- if ($elem['name']!==$timeRange) continue;
+ if ($elem['name'] !== $timeRange) continue;
- $start = empty($elem['attributes']['start'])?:$elem['attributes']['start'];
- $end = empty($elem['attributes']['end'])?:$elem['attributes']['end'];
+ $start = empty($elem['attributes']['start']) ?: $elem['attributes']['start'];
+ $end = empty($elem['attributes']['end']) ?: $elem['attributes']['end'];
}
if (!$start && !$end) {
diff --git a/lib/CalDAV/Xml/Request/InviteReply.php b/lib/CalDAV/Xml/Request/InviteReply.php
index ba0e8df..321fb35 100644
--- a/lib/CalDAV/Xml/Request/InviteReply.php
+++ b/lib/CalDAV/Xml/Request/InviteReply.php
@@ -2,13 +2,12 @@
namespace Sabre\CalDAV\Xml\Request;
-use
- Sabre\Xml\Reader,
- Sabre\Xml\XmlDeserializable,
- Sabre\Xml\Element\KeyValue,
- Sabre\DAV\Exception\BadRequest,
- Sabre\CalDAV\Plugin,
- Sabre\CalDAV\SharingPlugin;
+use Sabre\Xml\Reader;
+use Sabre\Xml\XmlDeserializable;
+use Sabre\Xml\Element\KeyValue;
+use Sabre\DAV\Exception\BadRequest;
+use Sabre\CalDAV\Plugin;
+use Sabre\CalDAV\SharingPlugin;
/**
* Invite-reply POST request parser
@@ -110,12 +109,12 @@ class InviteReply implements XmlDeserializable {
$summary = null;
$status = null;
- foreach($elems as $name=>$value) {
+ foreach ($elems as $name => $value) {
- switch($name) {
+ switch ($name) {
case '{' . Plugin::NS_CALENDARSERVER . '}hosturl' :
- foreach($value as $bla) {
+ foreach ($value as $bla) {
if ($bla['name'] === '{DAV:}href') {
$calendarUri = $bla['value'];
}
diff --git a/lib/CalDAV/Xml/Request/MkCalendar.php b/lib/CalDAV/Xml/Request/MkCalendar.php
index 41a162a..425f418 100644
--- a/lib/CalDAV/Xml/Request/MkCalendar.php
+++ b/lib/CalDAV/Xml/Request/MkCalendar.php
@@ -66,7 +66,7 @@ class MkCalendar implements XmlDeserializable {
$elementMap['{DAV:}set'] = 'Sabre\Xml\Element\KeyValue';
$elems = $reader->parseInnerTree($elementMap);
- foreach($elems as $elem) {
+ foreach ($elems as $elem) {
if ($elem['name'] === '{DAV:}set') {
$self->properties = array_merge($self->properties, $elem['value']['{DAV:}prop']);
}
diff --git a/lib/CalDAV/Xml/Request/Share.php b/lib/CalDAV/Xml/Request/Share.php
index d91e326..0dcda9b 100644
--- a/lib/CalDAV/Xml/Request/Share.php
+++ b/lib/CalDAV/Xml/Request/Share.php
@@ -78,30 +78,30 @@ class Share implements XmlDeserializable {
static function xmlDeserialize(Reader $reader) {
$elems = $reader->parseInnerTree([
- '{' . Plugin::NS_CALENDARSERVER . '}set' => 'Sabre\\Xml\\Element\\KeyValue',
+ '{' . Plugin::NS_CALENDARSERVER . '}set' => 'Sabre\\Xml\\Element\\KeyValue',
'{' . Plugin::NS_CALENDARSERVER . '}remove' => 'Sabre\\Xml\\Element\\KeyValue',
]);
$set = [];
$remove = [];
- foreach($elems as $elem) {
- switch($elem['name']) {
+ foreach ($elems as $elem) {
+ switch ($elem['name']) {
- case '{'.Plugin::NS_CALENDARSERVER.'}set' :
+ case '{' . Plugin::NS_CALENDARSERVER . '}set' :
$sharee = $elem['value'];
- $sumElem = '{'.Plugin::NS_CALENDARSERVER.'}summary';
+ $sumElem = '{' . Plugin::NS_CALENDARSERVER . '}summary';
$set[] = [
'href' => $sharee['{DAV:}href'],
- 'commonName' => $sharee['{'.Plugin::NS_CALENDARSERVER.'}common-name'],
- 'summary' => isset($sharee[$sumElem])?$sharee[$sumElem]:null,
+ 'commonName' => $sharee['{' . Plugin::NS_CALENDARSERVER . '}common-name'],
+ 'summary' => isset($sharee[$sumElem]) ? $sharee[$sumElem] : null,
'readOnly' => isset($sharee['{' . Plugin::NS_CALENDARSERVER . '}readOnly']),
];
break;
- case '{'.Plugin::NS_CALENDARSERVER.'}remove' :
+ case '{' . Plugin::NS_CALENDARSERVER . '}remove' :
$remove[] = $elem['value']['{DAV:}href'];
break;
diff --git a/lib/CardDAV/AddressBook.php b/lib/CardDAV/AddressBook.php
index b2328cb..31e9979 100644
--- a/lib/CardDAV/AddressBook.php
+++ b/lib/CardDAV/AddressBook.php
@@ -62,9 +62,9 @@ class AddressBook extends DAV\Collection implements IAddressBook, DAV\IPropertie
*/
function getChild($name) {
- $obj = $this->carddavBackend->getCard($this->addressBookInfo['id'],$name);
+ $obj = $this->carddavBackend->getCard($this->addressBookInfo['id'], $name);
if (!$obj) throw new DAV\Exception\NotFound('Card not found');
- return new Card($this->carddavBackend,$this->addressBookInfo,$obj);
+ return new Card($this->carddavBackend, $this->addressBookInfo, $obj);
}
@@ -77,9 +77,9 @@ class AddressBook extends DAV\Collection implements IAddressBook, DAV\IPropertie
$objs = $this->carddavBackend->getCards($this->addressBookInfo['id']);
$children = [];
- foreach($objs as $obj) {
+ foreach ($objs as $obj) {
$obj['acl'] = $this->getChildACL();
- $children[] = new Card($this->carddavBackend,$this->addressBookInfo,$obj);
+ $children[] = new Card($this->carddavBackend, $this->addressBookInfo, $obj);
}
return $children;
@@ -97,9 +97,9 @@ class AddressBook extends DAV\Collection implements IAddressBook, DAV\IPropertie
$objs = $this->carddavBackend->getMultipleCards($this->addressBookInfo['id'], $paths);
$children = [];
- foreach($objs as $obj) {
+ foreach ($objs as $obj) {
$obj['acl'] = $this->getChildACL();
- $children[] = new Card($this->carddavBackend,$this->addressBookInfo,$obj);
+ $children[] = new Card($this->carddavBackend, $this->addressBookInfo, $obj);
}
return $children;
@@ -130,7 +130,7 @@ class AddressBook extends DAV\Collection implements IAddressBook, DAV\IPropertie
* @param resource $vcardData
* @return string|null
*/
- function createFile($name,$vcardData = null) {
+ function createFile($name, $vcardData = null) {
if (is_resource($vcardData)) {
$vcardData = stream_get_contents($vcardData);
@@ -138,7 +138,7 @@ class AddressBook extends DAV\Collection implements IAddressBook, DAV\IPropertie
// Converting to UTF-8, if needed
$vcardData = DAV\StringUtil::ensureUTF8($vcardData);
- return $this->carddavBackend->createCard($this->addressBookInfo['id'],$name,$vcardData);
+ return $this->carddavBackend->createCard($this->addressBookInfo['id'], $name, $vcardData);
}
@@ -208,7 +208,7 @@ class AddressBook extends DAV\Collection implements IAddressBook, DAV\IPropertie
function getProperties($properties) {
$response = [];
- foreach($properties as $propertyName) {
+ foreach ($properties as $propertyName) {
if (isset($this->addressBookInfo[$propertyName])) {
diff --git a/lib/CardDAV/AddressBookHome.php b/lib/CardDAV/AddressBookHome.php
index a97e22e..fc399de 100644
--- a/lib/CardDAV/AddressBookHome.php
+++ b/lib/CardDAV/AddressBookHome.php
@@ -2,11 +2,10 @@
namespace Sabre\CardDAV;
-use
- Sabre\DAV,
- Sabre\DAV\MkCol,
- Sabre\DAVACL,
- Sabre\Uri;
+use Sabre\DAV;
+use Sabre\DAV\MkCol;
+use Sabre\DAVACL;
+use Sabre\Uri;
/**
* AddressBook Home class
@@ -53,7 +52,7 @@ class AddressBookHome extends DAV\Collection implements DAV\IExtendedCollection,
*/
function getName() {
- list(,$name) = Uri\split($this->principalUri);
+ list(, $name) = Uri\split($this->principalUri);
return $name;
}
@@ -101,7 +100,7 @@ class AddressBookHome extends DAV\Collection implements DAV\IExtendedCollection,
* @param resource $data
* @return void
*/
- function createFile($filename, $data=null) {
+ function createFile($filename, $data = null) {
throw new DAV\Exception\MethodNotAllowed('Creating new files in this collection is not supported');
@@ -130,8 +129,8 @@ class AddressBookHome extends DAV\Collection implements DAV\IExtendedCollection,
*/
function getChild($name) {
- foreach($this->getChildren() as $child) {
- if ($name==$child->getName())
+ foreach ($this->getChildren() as $child) {
+ if ($name == $child->getName())
return $child;
}
@@ -148,7 +147,7 @@ class AddressBookHome extends DAV\Collection implements DAV\IExtendedCollection,
$addressbooks = $this->carddavBackend->getAddressBooksForUser($this->principalUri);
$objs = [];
- foreach($addressbooks as $addressbook) {
+ foreach ($addressbooks as $addressbook) {
$objs[] = new AddressBook($this->carddavBackend, $addressbook);
}
return $objs;
@@ -165,7 +164,7 @@ class AddressBookHome extends DAV\Collection implements DAV\IExtendedCollection,
*/
function createExtendedCollection($name, MkCol $mkCol) {
- if (!$mkCol->hasResourceType('{'.Plugin::NS_CARDDAV.'}addressbook')) {
+ if (!$mkCol->hasResourceType('{' . Plugin::NS_CARDDAV . '}addressbook')) {
throw new DAV\Exception\InvalidResourceType('Unknown resourceType for this collection');
}
$properties = $mkCol->getRemainingValues();
diff --git a/lib/CardDAV/AddressBookRoot.php b/lib/CardDAV/AddressBookRoot.php
index c1c5cee..f96335c 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
*/
- 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);
diff --git a/lib/CardDAV/Backend/PDO.php b/lib/CardDAV/Backend/PDO.php
index 06e36a9..ce469b6 100644
--- a/lib/CardDAV/Backend/PDO.php
+++ b/lib/CardDAV/Backend/PDO.php
@@ -59,21 +59,21 @@ class PDO extends AbstractBackend implements SyncSupport {
*/
function getAddressBooksForUser($principalUri) {
- $stmt = $this->pdo->prepare('SELECT id, uri, displayname, principaluri, description, synctoken FROM '.$this->addressBooksTableName.' WHERE principaluri = ?');
+ $stmt = $this->pdo->prepare('SELECT id, uri, displayname, principaluri, description, synctoken FROM ' . $this->addressBooksTableName . ' WHERE principaluri = ?');
$stmt->execute([$principalUri]);
$addressBooks = [];
- foreach($stmt->fetchAll() as $row) {
+ foreach ($stmt->fetchAll() as $row) {
$addressBooks[] = [
- 'id' => $row['id'],
- 'uri' => $row['uri'],
- 'principaluri' => $row['principaluri'],
- '{DAV:}displayname' => $row['displayname'],
+ 'id' => $row['id'],
+ 'uri' => $row['uri'],
+ 'principaluri' => $row['principaluri'],
+ '{DAV:}displayname' => $row['displayname'],
'{' . CardDAV\Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'],
- '{http://calendarserver.org/ns/}getctag' => $row['synctoken'],
- '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0',
+ '{http://calendarserver.org/ns/}getctag' => $row['synctoken'],
+ '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
];
}
@@ -109,9 +109,9 @@ class PDO extends AbstractBackend implements SyncSupport {
$propPatch->handle($supportedProperties, function($mutations) use ($addressBookId) {
$updates = [];
- foreach($mutations as $property=>$newValue) {
+ foreach ($mutations as $property => $newValue) {
- switch($property) {
+ switch ($property) {
case '{DAV:}displayname' :
$updates['displayname'] = $newValue;
break;
@@ -122,15 +122,15 @@ class PDO extends AbstractBackend implements SyncSupport {
}
$query = 'UPDATE ' . $this->addressBooksTableName . ' SET ';
$first = true;
- foreach($updates as $key=>$value) {
+ foreach ($updates as $key => $value) {
if ($first) {
$first = false;
} else {
- $query.=', ';
+ $query .= ', ';
}
- $query.=' `' . $key . '` = :' . $key . ' ';
+ $query .= ' `' . $key . '` = :' . $key . ' ';
}
- $query.=' WHERE id = :addressbookid';
+ $query .= ' WHERE id = :addressbookid';
$stmt = $this->pdo->prepare($query);
$updates['addressbookid'] = $addressBookId;
@@ -156,15 +156,15 @@ class PDO extends AbstractBackend implements SyncSupport {
function createAddressBook($principalUri, $url, array $properties) {
$values = [
- 'displayname' => null,
- 'description' => null,
+ 'displayname' => null,
+ 'description' => null,
'principaluri' => $principalUri,
- 'uri' => $url,
+ 'uri' => $url,
];
- foreach($properties as $property=>$newValue) {
+ foreach ($properties as $property => $newValue) {
- switch($property) {
+ switch ($property) {
case '{DAV:}displayname' :
$values['displayname'] = $newValue;
break;
@@ -198,7 +198,7 @@ class PDO extends AbstractBackend implements SyncSupport {
$stmt = $this->pdo->prepare('DELETE FROM ' . $this->addressBooksTableName . ' WHERE id = ?');
$stmt->execute([$addressBookId]);
- $stmt = $this->pdo->prepare('DELETE FROM '.$this->addressBookChangesTableName.' WHERE id = ?');
+ $stmt = $this->pdo->prepare('DELETE FROM ' . $this->addressBookChangesTableName . ' WHERE id = ?');
$stmt->execute([$addressBookId]);
}
@@ -228,7 +228,7 @@ class PDO extends AbstractBackend implements SyncSupport {
$stmt->execute([$addressbookId]);
$result = [];
- while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
+ while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
$row['etag'] = '"' . $row['etag'] . '"';
$result[] = $row;
}
@@ -278,13 +278,13 @@ class PDO extends AbstractBackend implements SyncSupport {
$query = 'SELECT id, uri, lastmodified, etag, size, carddata FROM ' . $this->cardsTableName . ' WHERE addressbookid = ? AND uri IN (';
// Inserting a whole bunch of question marks
- $query.=implode(',', array_fill(0, count($uris), '?'));
- $query.=')';
+ $query .= implode(',', array_fill(0, count($uris), '?'));
+ $query .= ')';
$stmt = $this->pdo->prepare($query);
$stmt->execute(array_merge([$addressBookId], $uris));
$result = [];
- while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
+ while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
$row['etag'] = '"' . $row['etag'] . '"';
$result[] = $row;
}
@@ -397,7 +397,7 @@ class PDO extends AbstractBackend implements SyncSupport {
$this->addChange($addressBookId, $cardUri, 3);
- return $stmt->rowCount()===1;
+ return $stmt->rowCount() === 1;
}
@@ -476,7 +476,7 @@ class PDO extends AbstractBackend implements SyncSupport {
if ($syncToken) {
$query = "SELECT uri, operation FROM " . $this->addressBookChangesTableName . " WHERE synctoken >= ? AND synctoken < ? AND addressbookid = ? ORDER BY synctoken";
- if ($limit>0) $query.= " LIMIT " . (int)$limit;
+ if ($limit > 0) $query .= " LIMIT " . (int)$limit;
// Fetching all changes
$stmt = $this->pdo->prepare($query);
@@ -486,15 +486,15 @@ class PDO extends AbstractBackend implements SyncSupport {
// This loop ensures that any duplicates are overwritten, only the
// last change on a node is relevant.
- while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
+ while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
$changes[$row['uri']] = $row['operation'];
}
- foreach($changes as $uri => $operation) {
+ foreach ($changes as $uri => $operation) {
- switch($operation) {
+ switch ($operation) {
case 1:
$result['added'][] = $uri;
break;
@@ -529,7 +529,7 @@ class PDO extends AbstractBackend implements SyncSupport {
*/
protected function addChange($addressBookId, $objectUri, $operation) {
- $stmt = $this->pdo->prepare('INSERT INTO ' . $this->addressBookChangesTableName .' (uri, synctoken, addressbookid, operation) SELECT ?, synctoken, ?, ? FROM ' . $this->addressBooksTableName . ' WHERE id = ?');
+ $stmt = $this->pdo->prepare('INSERT INTO ' . $this->addressBookChangesTableName . ' (uri, synctoken, addressbookid, operation) SELECT ?, synctoken, ?, ? FROM ' . $this->addressBooksTableName . ' WHERE id = ?');
$stmt->execute([
$objectUri,
$addressBookId,
diff --git a/lib/CardDAV/Card.php b/lib/CardDAV/Card.php
index 17755d5..80b81af 100644
--- a/lib/CardDAV/Card.php
+++ b/lib/CardDAV/Card.php
@@ -5,7 +5,6 @@ namespace Sabre\CardDAV;
use Sabre\DAVACL;
use Sabre\DAV;
-
/**
* The Card object represents a single Card from an addressbook
*
@@ -43,7 +42,7 @@ class Card extends DAV\File implements ICard, DAVACL\IACL {
* @param array $addressBookInfo
* @param array $cardData
*/
- function __construct(Backend\BackendInterface $carddavBackend,array $addressBookInfo,array $cardData) {
+ function __construct(Backend\BackendInterface $carddavBackend, array $addressBookInfo, array $cardData) {
$this->carddavBackend = $carddavBackend;
$this->addressBookInfo = $addressBookInfo;
@@ -92,7 +91,7 @@ class Card extends DAV\File implements ICard, DAVACL\IACL {
// Converting to UTF-8, if needed
$cardData = DAV\StringUtil::ensureUTF8($cardData);
- $etag = $this->carddavBackend->updateCard($this->addressBookInfo['id'],$this->cardData['uri'],$cardData);
+ $etag = $this->carddavBackend->updateCard($this->addressBookInfo['id'], $this->cardData['uri'], $cardData);
$this->cardData['carddata'] = $cardData;
$this->cardData['etag'] = $etag;
@@ -107,7 +106,7 @@ class Card extends DAV\File implements ICard, DAVACL\IACL {
*/
function delete() {
- $this->carddavBackend->deleteCard($this->addressBookInfo['id'],$this->cardData['uri']);
+ $this->carddavBackend->deleteCard($this->addressBookInfo['id'], $this->cardData['uri']);
}
@@ -150,7 +149,7 @@ class Card extends DAV\File implements ICard, DAVACL\IACL {
*/
function getLastModified() {
- return isset($this->cardData['lastmodified'])?$this->cardData['lastmodified']:null;
+ return isset($this->cardData['lastmodified']) ? $this->cardData['lastmodified'] : null;
}
@@ -262,4 +261,3 @@ class Card extends DAV\File implements ICard, DAVACL\IACL {
}
}
-
diff --git a/lib/CardDAV/ICard.php b/lib/CardDAV/ICard.php
index 558852b..a159319 100644
--- a/lib/CardDAV/ICard.php
+++ b/lib/CardDAV/ICard.php
@@ -17,4 +17,3 @@ use Sabre\DAV;
interface ICard extends DAV\IFile {
}
-
diff --git a/lib/CardDAV/Plugin.php b/lib/CardDAV/Plugin.php
index 326e0a3..7cde013 100644
--- a/lib/CardDAV/Plugin.php
+++ b/lib/CardDAV/Plugin.php
@@ -2,16 +2,14 @@
namespace Sabre\CardDAV;
-use
- Sabre\DAV,
- Sabre\DAV\Exception\ReportNotSupported,
- Sabre\DAV\Xml\Property\Href,
- Sabre\DAVACL,
- Sabre\HTTP,
- Sabre\HTTP\RequestInterface,
- Sabre\HTTP\ResponseInterface,
- Sabre\VObject;
-
+use Sabre\DAV;
+use Sabre\DAV\Exception\ReportNotSupported;
+use Sabre\DAV\Xml\Property\Href;
+use Sabre\DAVACL;
+use Sabre\HTTP;
+use Sabre\HTTP\RequestInterface;
+use Sabre\HTTP\ResponseInterface;
+use Sabre\VObject;
/**
* CardDAV plugin
@@ -66,7 +64,7 @@ class Plugin extends DAV\ServerPlugin {
/* Events */
$server->on('propFind', [$this, 'propFindEarly']);
- $server->on('propFind', [$this, 'propFindLate'],150);
+ $server->on('propFind', [$this, 'propFindLate'], 150);
$server->on('report', [$this, 'report']);
$server->on('onHTMLActionsPanel', [$this, 'htmlActionsPanel']);
$server->on('beforeWriteContent', [$this, 'beforeWriteContent']);
@@ -192,14 +190,14 @@ class Plugin extends DAV\ServerPlugin {
* @param \DOMNode $dom
* @return bool
*/
- function report($reportName,$dom) {
+ function report($reportName, $dom) {
- switch($reportName) {
- case '{'.self::NS_CARDDAV.'}addressbook-multiget' :
+ switch ($reportName) {
+ case '{' . self::NS_CARDDAV . '}addressbook-multiget' :
$this->server->transactionType = 'report-addressbook-multiget';
$this->addressbookMultiGetReport($dom);
return false;
- case '{'.self::NS_CARDDAV.'}addressbook-query' :
+ case '{' . self::NS_CARDDAV . '}addressbook-query' :
$this->server->transactionType = 'report-addressbook-query';
$this->addressBookQueryReport($dom);
return false;
@@ -239,7 +237,7 @@ class Plugin extends DAV\ServerPlugin {
$contentType = $report->contentType;
$version = $report->version;
if ($version) {
- $contentType.='; version=' . $version;
+ $contentType .= '; version=' . $version;
}
$vcardType = $this->negotiateVCard(
@@ -247,7 +245,7 @@ class Plugin extends DAV\ServerPlugin {
);
$propertyList = [];
- foreach($this->server->getPropertiesForMultiplePaths($report->hrefs, $report->properties) as $props) {
+ foreach ($this->server->getPropertiesForMultiplePaths($report->hrefs, $report->properties) as $props) {
if (isset($props['200']['{' . self::NS_CARDDAV . '}address-data'])) {
@@ -264,8 +262,8 @@ class Plugin extends DAV\ServerPlugin {
$prefer = $this->server->getHTTPPRefer();
$this->server->httpResponse->setStatus(207);
- $this->server->httpResponse->setHeader('Content-Type','application/xml; charset=utf-8');
- $this->server->httpResponse->setHeader('Vary','Brief,Prefer');
+ $this->server->httpResponse->setHeader('Content-Type', 'application/xml; charset=utf-8');
+ $this->server->httpResponse->setHeader('Vary', 'Brief,Prefer');
$this->server->httpResponse->setBody($this->server->generateMultiStatus($propertyList, $prefer['return-minimal']));
}
@@ -342,7 +340,7 @@ class Plugin extends DAV\ServerPlugin {
// If the data starts with a [, we can reasonably assume we're dealing
// with a jCal object.
- if (substr($data,0,1)==='[') {
+ if (substr($data, 0, 1) === '[') {
$vobj = VObject\Reader::readJson($data);
// Converting $data back to iCalendar, as that's what we
@@ -386,7 +384,7 @@ class Plugin extends DAV\ServerPlugin {
$depth = $this->server->getHTTPDepth(0);
- if ($depth==0) {
+ if ($depth == 0) {
$candidateNodes = [
$this->server->tree->getNodeForPath($this->server->getRequestUri())
];
@@ -399,7 +397,7 @@ class Plugin extends DAV\ServerPlugin {
$contentType = $report->contentType;
if ($report->version) {
- $contentType.='; version=' . $report->version;
+ $contentType .= '; version=' . $report->version;
}
$vcardType = $this->negotiateVCard(
@@ -407,7 +405,7 @@ class Plugin extends DAV\ServerPlugin {
);
$validNodes = [];
- foreach($candidateNodes as $node) {
+ foreach ($candidateNodes as $node) {
if (!$node instanceof ICard)
continue;
@@ -431,9 +429,9 @@ class Plugin extends DAV\ServerPlugin {
}
$result = [];
- foreach($validNodes as $validNode) {
+ foreach ($validNodes as $validNode) {
- if ($depth==0) {
+ if ($depth == 0) {
$href = $this->server->getRequestUri();
} else {
$href = $this->server->getRequestUri() . '/' . $validNode->getName();
@@ -456,8 +454,8 @@ class Plugin extends DAV\ServerPlugin {
$prefer = $this->server->getHTTPPRefer();
$this->server->httpResponse->setStatus(207);
- $this->server->httpResponse->setHeader('Content-Type','application/xml; charset=utf-8');
- $this->server->httpResponse->setHeader('Vary','Brief,Prefer');
+ $this->server->httpResponse->setHeader('Content-Type', 'application/xml; charset=utf-8');
+ $this->server->httpResponse->setHeader('Vary', 'Brief,Prefer');
$this->server->httpResponse->setBody($this->server->generateMultiStatus($result, $prefer['return-minimal']));
}
@@ -476,7 +474,7 @@ class Plugin extends DAV\ServerPlugin {
if (!$filters) return true;
- foreach($filters as $filter) {
+ foreach ($filters as $filter) {
$isDefined = isset($vcard->{$filter['name']});
if ($filter['is-not-defined']) {
@@ -500,13 +498,13 @@ class Plugin extends DAV\ServerPlugin {
}
if ($filter['text-matches']) {
$texts = [];
- foreach($vProperties as $vProperty)
+ foreach ($vProperties as $vProperty)
$texts[] = $vProperty->getValue();
$results[] = $this->validateTextMatches($texts, $filter['text-matches'], $filter['test']);
}
- if (count($results)===1) {
+ if (count($results) === 1) {
$success = $results[0];
} else {
if ($filter['test'] === 'anyof') {
@@ -520,10 +518,10 @@ class Plugin extends DAV\ServerPlugin {
// There are two conditions where we can already determine whether
// or not this filter succeeds.
- if ($test==='anyof' && $success) {
+ if ($test === 'anyof' && $success) {
return true;
}
- if ($test==='allof' && !$success) {
+ if ($test === 'allof' && !$success) {
return false;
}
@@ -534,7 +532,7 @@ class Plugin extends DAV\ServerPlugin {
//
// This implies for 'anyof' that the test failed, and for 'allof' that
// we succeeded. Sounds weird, but makes sense.
- return $test==='allof';
+ return $test === 'allof';
}
@@ -551,10 +549,10 @@ class Plugin extends DAV\ServerPlugin {
*/
protected function validateParamFilters(array $vProperties, array $filters, $test) {
- foreach($filters as $filter) {
+ foreach ($filters as $filter) {
$isDefined = false;
- foreach($vProperties as $vProperty) {
+ foreach ($vProperties as $vProperty) {
$isDefined = isset($vProperty[$filter['name']]);
if ($isDefined) break;
}
@@ -574,7 +572,7 @@ class Plugin extends DAV\ServerPlugin {
} else {
$success = false;
- foreach($vProperties as $vProperty) {
+ foreach ($vProperties as $vProperty) {
// If we got all the way here, we'll need to validate the
// text-match filter.
$success = DAV\StringUtil::textMatch($vProperty[$filter['name']]->getValue(), $filter['text-match']['value'], $filter['text-match']['collation'], $filter['text-match']['match-type']);
@@ -588,10 +586,10 @@ class Plugin extends DAV\ServerPlugin {
// There are two conditions where we can already determine whether
// or not this filter succeeds.
- if ($test==='anyof' && $success) {
+ if ($test === 'anyof' && $success) {
return true;
}
- if ($test==='allof' && !$success) {
+ if ($test === 'allof' && !$success) {
return false;
}
@@ -602,7 +600,7 @@ class Plugin extends DAV\ServerPlugin {
//
// This implies for 'anyof' that the test failed, and for 'allof' that
// we succeeded. Sounds weird, but makes sense.
- return $test==='allof';
+ return $test === 'allof';
}
@@ -616,10 +614,10 @@ class Plugin extends DAV\ServerPlugin {
*/
protected function validateTextMatches(array $texts, array $filters, $test) {
- foreach($filters as $filter) {
+ foreach ($filters as $filter) {
$success = false;
- foreach($texts as $haystack) {
+ foreach ($texts as $haystack) {
$success = DAV\StringUtil::textMatch($haystack, $filter['value'], $filter['collation'], $filter['match-type']);
// Breaking on the first match
@@ -629,10 +627,10 @@ class Plugin extends DAV\ServerPlugin {
$success = !$success;
}
- if ($success && $test==='anyof')
+ if ($success && $test === 'anyof')
return true;
- if (!$success && $test=='allof')
+ if (!$success && $test == 'allof')
return false;
@@ -643,7 +641,7 @@ class Plugin extends DAV\ServerPlugin {
//
// This implies for 'anyof' that the test failed, and for 'allof' that
// we succeeded. Sounds weird, but makes sense.
- return $test==='allof';
+ return $test === 'allof';
}
@@ -659,7 +657,7 @@ class Plugin extends DAV\ServerPlugin {
// the content-type property. By default SabreDAV will send back
// text/x-vcard; charset=utf-8, but for SOGO we must strip that last
// part.
- if (strpos($this->server->httpRequest->getHeader('User-Agent'),'Thunderbird')===false) {
+ if (strpos($this->server->httpRequest->getHeader('User-Agent'), 'Thunderbird') === false) {
return;
}
$contentType = $propFind->get('{DAV:}getcontenttype');
@@ -684,7 +682,7 @@ class Plugin extends DAV\ServerPlugin {
if (!$node instanceof AddressBookHome)
return;
- $output.= '<tr><td colspan="2"><form method="post" action="">
+ $output .= '<tr><td colspan="2"><form method="post" action="">
<h3>Create new address book</h3>
<input type="hidden" name="sabreAction" value="mkcol" />
<input type="hidden" name="resourceType" value="{DAV:}collection,{' . self::NS_CARDDAV . '}addressbook" />
@@ -709,7 +707,7 @@ class Plugin extends DAV\ServerPlugin {
*/
function httpAfterGet(RequestInterface $request, ResponseInterface $response) {
- if (strpos($response->getHeader('Content-Type'),'text/vcard')===false) {
+ if (strpos($response->getHeader('Content-Type'), 'text/vcard') === false) {
return;
}
@@ -760,7 +758,7 @@ class Plugin extends DAV\ServerPlugin {
);
$mimeType = $result;
- switch($result) {
+ switch ($result) {
default :
case 'text/x-vcard' :
@@ -789,7 +787,7 @@ class Plugin extends DAV\ServerPlugin {
protected function convertVCard($data, $target) {
$data = VObject\Reader::read($data);
- switch($target) {
+ switch ($target) {
default :
case 'vcard3' :
$data = $data->convert(VObject\Document::VCARD30);
diff --git a/lib/CardDAV/VCFExportPlugin.php b/lib/CardDAV/VCFExportPlugin.php
index 7cadf17..fe5ef0e 100644
--- a/lib/CardDAV/VCFExportPlugin.php
+++ b/lib/CardDAV/VCFExportPlugin.php
@@ -2,11 +2,10 @@
namespace Sabre\CardDAV;
-use
- Sabre\DAV,
- Sabre\VObject,
- Sabre\HTTP\RequestInterface,
- Sabre\HTTP\ResponseInterface;
+use Sabre\DAV;
+use Sabre\VObject;
+use Sabre\HTTP\RequestInterface;
+use Sabre\HTTP\ResponseInterface;
/**
* VCF Exporter
@@ -38,7 +37,7 @@ class VCFExportPlugin extends DAV\ServerPlugin {
function initialize(DAV\Server $server) {
$this->server = $server;
- $this->server->on('method:GET', [$this,'httpGet'], 90);
+ $this->server->on('method:GET', [$this, 'httpGet'], 90);
}
@@ -67,12 +66,12 @@ class VCFExportPlugin extends DAV\ServerPlugin {
$aclPlugin->checkPrivileges($path, '{DAV:}read');
}
- $response->setHeader('Content-Type','text/directory');
+ $response->setHeader('Content-Type', 'text/directory');
$response->setStatus(200);
$nodes = $this->server->getPropertiesForPath($path, [
'{' . Plugin::NS_CARDDAV . '}address-data',
- ],1);
+ ], 1);
$response->setBody($this->generateVCF($nodes));
@@ -91,7 +90,7 @@ class VCFExportPlugin extends DAV\ServerPlugin {
$output = "";
- foreach($nodes as $node) {
+ foreach ($nodes as $node) {
if (!isset($node[200]['{' . Plugin::NS_CARDDAV . '}address-data'])) {
continue;
diff --git a/lib/CardDAV/Xml/Filter/AddressData.php b/lib/CardDAV/Xml/Filter/AddressData.php
index 06b074c..ee7dd99 100644
--- a/lib/CardDAV/Xml/Filter/AddressData.php
+++ b/lib/CardDAV/Xml/Filter/AddressData.php
@@ -2,10 +2,8 @@
namespace Sabre\CardDAV\Xml\Filter;
-use
- Sabre\Xml\Reader,
- Sabre\Xml\XmlDeserializable;
-
+use Sabre\Xml\Reader;
+use Sabre\Xml\XmlDeserializable;
/**
* AddressData parser.
@@ -49,8 +47,8 @@ class AddressData implements XmlDeserializable {
static function xmlDeserialize(Reader $reader) {
$result = [
- 'contentType' => $reader->getAttribute('content-type')?:'text/vcard',
- 'version' => $reader->getAttribute('version')?:'3.0',
+ 'contentType' => $reader->getAttribute('content-type') ?: 'text/vcard',
+ 'version' => $reader->getAttribute('version') ?: '3.0',
];
$reader->next();
diff --git a/lib/CardDAV/Xml/Filter/ParamFilter.php b/lib/CardDAV/Xml/Filter/ParamFilter.php
index 706929c..5990f20 100644
--- a/lib/CardDAV/Xml/Filter/ParamFilter.php
+++ b/lib/CardDAV/Xml/Filter/ParamFilter.php
@@ -47,9 +47,9 @@ abstract class ParamFilter implements Element {
static function xmlDeserialize(Reader $reader) {
$result = [
- 'name' => null,
+ 'name' => null,
'is-not-defined' => false,
- 'text-match' => null,
+ 'text-match' => null,
];
$att = $reader->parseAttributes();
@@ -57,22 +57,22 @@ abstract class ParamFilter implements Element {
$elems = $reader->parseInnerTree();
- if (is_array($elems)) foreach($elems as $elem) {
+ if (is_array($elems)) foreach ($elems as $elem) {
- switch($elem['name']) {
+ switch ($elem['name']) {
case '{' . Plugin::NS_CARDDAV . '}is-not-defined' :
$result['is-not-defined'] = true;
break;
case '{' . Plugin::NS_CARDDAV . '}text-match' :
- $matchType = isset($elem['attributes']['match-type'])?$elem['attributes']['match-type']:'contains';
+ $matchType = isset($elem['attributes']['match-type']) ? $elem['attributes']['match-type'] : 'contains';
if (!in_array($matchType, ['contains', 'equals', 'starts-with', 'ends-with'])) {
throw new BadRequest('Unknown match-type: ' . $matchType);
}
$result['text-match'] = [
- 'negate-condition' => isset($elem['attributes']['negate-condition']) && $elem['attributes']['negate-condition']==='yes',
- 'collation' => isset($elem['attributes']['collation'])?$elem['attributes']['collation']:'i;unicode-casemap',
+ 'negate-condition' => isset($elem['attributes']['negate-condition']) && $elem['attributes']['negate-condition'] === 'yes',
+ 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;unicode-casemap',
'value' => $elem['value'],
'match-type' => $matchType,
];
diff --git a/lib/CardDAV/Xml/Filter/PropFilter.php b/lib/CardDAV/Xml/Filter/PropFilter.php
index 1c7e7b2..0a8ed1e 100644
--- a/lib/CardDAV/Xml/Filter/PropFilter.php
+++ b/lib/CardDAV/Xml/Filter/PropFilter.php
@@ -7,7 +7,6 @@ use Sabre\Xml\XmlDeserializable;
use Sabre\DAV\Exception\BadRequest;
use Sabre\CardDAV\Plugin;
-
/**
* PropFilter parser.
*
@@ -17,9 +16,9 @@ use Sabre\CardDAV\Plugin;
* http://tools.ietf.org/html/rfc6352#section-10.5.1
*
* The result will be spit out as an array.
- *
+ *
* @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 PropFilter implements XmlDeserializable {
@@ -48,25 +47,25 @@ class PropFilter implements XmlDeserializable {
static function xmlDeserialize(Reader $reader) {
$result = [
- 'name' => null,
- 'test' => 'anyof',
+ 'name' => null,
+ 'test' => 'anyof',
'is-not-defined' => false,
- 'param-filters' => [],
- 'text-matches' => [],
+ 'param-filters' => [],
+ 'text-matches' => [],
];
$att = $reader->parseAttributes();
$result['name'] = $att['name'];
- if (isset($att['test']) && $att['test']==='allof') {
+ if (isset($att['test']) && $att['test'] === 'allof') {
$result['test'] = 'allof';
}
$elems = $reader->parseInnerTree();
- if (is_array($elems)) foreach($elems as $elem) {
+ if (is_array($elems)) foreach ($elems as $elem) {
- switch($elem['name']) {
+ switch ($elem['name']) {
case '{' . Plugin::NS_CARDDAV . '}param-filter' :
$result['param-filters'][] = $elem['value'];
@@ -75,14 +74,14 @@ class PropFilter implements XmlDeserializable {
$result['is-not-defined'] = true;
break;
case '{' . Plugin::NS_CARDDAV . '}text-match' :
- $matchType = isset($elem['attributes']['match-type'])?$elem['attributes']['match-type']:'contains';
+ $matchType = isset($elem['attributes']['match-type']) ? $elem['attributes']['match-type'] : 'contains';
if (!in_array($matchType, ['contains', 'equals', 'starts-with', 'ends-with'])) {
throw new BadRequest('Unknown match-type: ' . $matchType);
}
$result['text-matches'][] = [
- 'negate-condition' => isset($elem['attributes']['negate-condition']) && $elem['attributes']['negate-condition']==='yes',
- 'collation' => isset($elem['attributes']['collation'])?$elem['attributes']['collation']:'i;unicode-casemap',
+ 'negate-condition' => isset($elem['attributes']['negate-condition']) && $elem['attributes']['negate-condition'] === 'yes',
+ 'collation' => isset($elem['attributes']['collation']) ? $elem['attributes']['collation'] : 'i;unicode-casemap',
'value' => $elem['value'],
'match-type' => $matchType,
];
diff --git a/lib/CardDAV/Xml/Property/SupportedAddressData.php b/lib/CardDAV/Xml/Property/SupportedAddressData.php
index 0d05f1f..fdb3bb1 100644
--- a/lib/CardDAV/Xml/Property/SupportedAddressData.php
+++ b/lib/CardDAV/Xml/Property/SupportedAddressData.php
@@ -69,11 +69,11 @@ class SupportedAddressData implements XmlSerializable {
*/
function xmlSerialize(Writer $writer) {
- foreach($this->supportedData as $supported) {
+ foreach ($this->supportedData as $supported) {
$writer->startElement('{' . Plugin::NS_CARDDAV . '}address-data-type');
$writer->writeAttributes([
'content-type' => $supported['contentType'],
- 'version' => $supported['version']
+ 'version' => $supported['version']
]);
$writer->endElement(); // address-data-type
}
diff --git a/lib/CardDAV/Xml/Property/SupportedCollationSet.php b/lib/CardDAV/Xml/Property/SupportedCollationSet.php
index 1f6016c..2321bea 100644
--- a/lib/CardDAV/Xml/Property/SupportedCollationSet.php
+++ b/lib/CardDAV/Xml/Property/SupportedCollationSet.php
@@ -38,7 +38,7 @@ class SupportedCollationSet implements XmlSerializable {
*/
function xmlSerialize(Writer $writer) {
- foreach(['i;ascii-casemap', 'i;octet', 'i;unicode-casemap'] as $coll) {
+ foreach (['i;ascii-casemap', 'i;octet', 'i;unicode-casemap'] as $coll) {
$writer->writeElement('{urn:ietf:params:xml:ns:carddav}supported-collation', $coll);
}
diff --git a/lib/CardDAV/Xml/Request/AddressBookMultiGetReport.php b/lib/CardDAV/Xml/Request/AddressBookMultiGetReport.php
index 2d4e801..8e1154d 100644
--- a/lib/CardDAV/Xml/Request/AddressBookMultiGetReport.php
+++ b/lib/CardDAV/Xml/Request/AddressBookMultiGetReport.php
@@ -80,18 +80,18 @@ class AddressBookMultiGetReport implements XmlDeserializable {
]);
$newProps = [
- 'hrefs' => [],
+ 'hrefs' => [],
'properties' => []
];
- foreach($elems as $elem) {
+ foreach ($elems as $elem) {
- switch($elem['name']) {
+ switch ($elem['name']) {
case '{DAV:}prop' :
$newProps['properties'] = array_keys($elem['value']);
if (isset($elem['value']['{' . Plugin::NS_CARDDAV . '}address-data'])) {
- $newProps+=$elem['value']['{' . Plugin::NS_CARDDAV . '}address-data'];
+ $newProps += $elem['value']['{' . Plugin::NS_CARDDAV . '}address-data'];
}
break;
case '{DAV:}href' :
@@ -103,7 +103,7 @@ class AddressBookMultiGetReport implements XmlDeserializable {
}
$obj = new self();
- foreach($newProps as $key=>$value) {
+ foreach ($newProps as $key => $value) {
$obj->$key = $value;
}
return $obj;
diff --git a/lib/CardDAV/Xml/Request/AddressBookQueryReport.php b/lib/CardDAV/Xml/Request/AddressBookQueryReport.php
index b2840a2..c9e5480 100644
--- a/lib/CardDAV/Xml/Request/AddressBookQueryReport.php
+++ b/lib/CardDAV/Xml/Request/AddressBookQueryReport.php
@@ -120,46 +120,46 @@ class AddressBookQueryReport implements XmlDeserializable {
]);
$newProps = [
- 'filters' => null,
+ 'filters' => null,
'properties' => [],
- 'test' => 'anyof',
- 'limit' => null,
+ 'test' => 'anyof',
+ 'limit' => null,
];
if (!is_array($elems)) $elems = [];
- foreach($elems as $elem) {
+ foreach ($elems as $elem) {
- switch($elem['name']) {
+ switch ($elem['name']) {
case '{DAV:}prop' :
$newProps['properties'] = array_keys($elem['value']);
if (isset($elem['value']['{' . Plugin::NS_CARDDAV . '}address-data'])) {
- $newProps+=$elem['value']['{' . Plugin::NS_CARDDAV . '}address-data'];
+ $newProps += $elem['value']['{' . Plugin::NS_CARDDAV . '}address-data'];
}
break;
- case '{'.Plugin::NS_CARDDAV.'}filter' :
+ case '{' . Plugin::NS_CARDDAV . '}filter' :
if (!is_null($newProps['filters'])) {
throw new BadRequest('You can only include 1 {' . Plugin::NS_CARDDAV . '}filter element');
}
if (isset($elem['attributes']['test'])) {
$newProps['test'] = $elem['attributes']['test'];
- if ($newProps['test']!=='allof' && $newProps['test']!=='anyof') {
+ if ($newProps['test'] !== 'allof' && $newProps['test'] !== 'anyof') {
throw new BadRequest('The "test" attribute must be one of "allof" or "anyof"');
}
}
$newProps['filters'] = [];
- foreach((array)$elem['value'] as $subElem) {
+ foreach ((array)$elem['value'] as $subElem) {
if ($subElem['name'] === '{' . Plugin::NS_CARDDAV . '}prop-filter') {
$newProps['filters'][] = $subElem['value'];
}
}
break;
- case '{'.Plugin::NS_CARDDAV.'}limit' :
- foreach($elem['value'] as $child) {
- if ($child['name'] === '{'. Plugin::NS_CARDDAV .'}nresults') {
+ case '{' . Plugin::NS_CARDDAV . '}limit' :
+ foreach ($elem['value'] as $child) {
+ if ($child['name'] === '{' . Plugin::NS_CARDDAV . '}nresults') {
$newProps['limit'] = (int)$child['value'];
}
}
@@ -170,18 +170,18 @@ class AddressBookQueryReport implements XmlDeserializable {
}
if (is_null($newProps['filters'])) {
- /**
- * We are supposed to throw this error, but KDE sometimes does not
- * include the filter element, and we need to treat it as if no
- * filters are supplied
- */
+/**
+ * We are supposed to throw this error, but KDE sometimes does not
+ * include the filter element, and we need to treat it as if no
+ * filters are supplied
+ */
//throw new BadRequest('The {' . Plugin::NS_CARDDAV . '}filter element is required for this request');
$newProps['filters'] = [];
}
$obj = new self();
- foreach($newProps as $key=>$value) {
+ foreach ($newProps as $key => $value) {
$obj->$key = $value;
}
diff --git a/lib/DAV/Auth/Backend/AbstractBasic.php b/lib/DAV/Auth/Backend/AbstractBasic.php
index bc31f64..8a9aa56 100644
--- a/lib/DAV/Auth/Backend/AbstractBasic.php
+++ b/lib/DAV/Auth/Backend/AbstractBasic.php
@@ -2,11 +2,10 @@
namespace Sabre\DAV\Auth\Backend;
-use
- Sabre\DAV,
- Sabre\HTTP,
- Sabre\HTTP\RequestInterface,
- Sabre\HTTP\ResponseInterface;
+use Sabre\DAV;
+use Sabre\HTTP;
+use Sabre\HTTP\RequestInterface;
+use Sabre\HTTP\ResponseInterface;
/**
* HTTP Basic authentication backend class
@@ -103,7 +102,7 @@ abstract class AbstractBasic implements BackendInterface {
if (!$userpass) {
return [false, "No 'Authorization: Basic' header found. Either the client didn't send one, or the server is mis-configured"];
}
- if (!$this->validateUserPass($userpass[0],$userpass[1])) {
+ if (!$this->validateUserPass($userpass[0], $userpass[1])) {
return [false, "Username or password was incorrect"];
}
return [true, $this->principalPrefix . $userpass[0]];
@@ -143,4 +142,3 @@ abstract class AbstractBasic implements BackendInterface {
}
}
-
diff --git a/lib/DAV/Auth/Backend/AbstractDigest.php b/lib/DAV/Auth/Backend/AbstractDigest.php
index 7693282..68acb17 100644
--- a/lib/DAV/Auth/Backend/AbstractDigest.php
+++ b/lib/DAV/Auth/Backend/AbstractDigest.php
@@ -2,11 +2,10 @@
namespace Sabre\DAV\Auth\Backend;
-use
- Sabre\HTTP,
- Sabre\DAV,
- Sabre\HTTP\RequestInterface,
- Sabre\HTTP\ResponseInterface;
+use Sabre\HTTP;
+use Sabre\DAV;
+use Sabre\HTTP\RequestInterface;
+use Sabre\HTTP\ResponseInterface;
/**
* HTTP Digest authentication backend class
@@ -111,7 +110,7 @@ abstract class AbstractDigest implements BackendInterface {
$hash = $this->getDigestHash($this->realm, $username);
// If this was false, the user account didn't exist
- if ($hash===false || is_null($hash)) {
+ if ($hash === false || is_null($hash)) {
return [false, "Username or password was incorrect"];
}
if (!is_string($hash)) {
diff --git a/lib/DAV/Auth/Backend/Apache.php b/lib/DAV/Auth/Backend/Apache.php
index 3b43742..5e3126c 100644
--- a/lib/DAV/Auth/Backend/Apache.php
+++ b/lib/DAV/Auth/Backend/Apache.php
@@ -2,10 +2,8 @@
namespace Sabre\DAV\Auth\Backend;
-use
- Sabre\DAV,
- Sabre\HTTP\RequestInterface,
- Sabre\HTTP\ResponseInterface;
+use Sabre\HTTP\RequestInterface;
+use Sabre\HTTP\ResponseInterface;
/**
* Apache authenticator
@@ -96,4 +94,3 @@ class Apache implements BackendInterface {
}
}
-
diff --git a/lib/DAV/Auth/Backend/BackendInterface.php b/lib/DAV/Auth/Backend/BackendInterface.php
index 4c9189b..d6042f8 100644
--- a/lib/DAV/Auth/Backend/BackendInterface.php
+++ b/lib/DAV/Auth/Backend/BackendInterface.php
@@ -2,9 +2,8 @@
namespace Sabre\DAV\Auth\Backend;
-use
- Sabre\HTTP\RequestInterface,
- Sabre\HTTP\ResponseInterface;
+use Sabre\HTTP\RequestInterface;
+use Sabre\HTTP\ResponseInterface;
/**
* This is the base class for any authentication object.
@@ -69,4 +68,3 @@ interface BackendInterface {
function challenge(RequestInterface $request, ResponseInterface $response);
}
-
diff --git a/lib/DAV/Auth/Backend/BasicCallBack.php b/lib/DAV/Auth/Backend/BasicCallBack.php
index 1675c42..aee7aac 100644
--- a/lib/DAV/Auth/Backend/BasicCallBack.php
+++ b/lib/DAV/Auth/Backend/BasicCallBack.php
@@ -2,8 +2,6 @@
namespace Sabre\DAV\Auth\Backend;
-use Sabre\DAV;
-
/**
* Extremely simply HTTP Basic auth backend.
*
@@ -11,7 +9,7 @@ use Sabre\DAV;
* username and password.
* The callback must return true or false depending on if authentication was
* correct.
-
+ *
* @copyright Copyright (C) 2007-2015 fruux GmbH (https://fruux.com/).
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
@@ -58,4 +56,3 @@ class BasicCallBack extends AbstractBasic {
}
}
-
diff --git a/lib/DAV/Auth/Backend/File.php b/lib/DAV/Auth/Backend/File.php
index 714e44c..6fbb518 100644
--- a/lib/DAV/Auth/Backend/File.php
+++ b/lib/DAV/Auth/Backend/File.php
@@ -29,7 +29,7 @@ class File extends AbstractDigest {
*
* @param string|null $filename
*/
- function __construct($filename=null) {
+ function __construct($filename = null) {
if (!is_null($filename))
$this->loadFile($filename);
@@ -45,12 +45,12 @@ class File extends AbstractDigest {
*/
function loadFile($filename) {
- foreach(file($filename,FILE_IGNORE_NEW_LINES) as $line) {
+ foreach (file($filename, FILE_IGNORE_NEW_LINES) as $line) {
if (substr_count($line, ":") !== 2)
throw new DAV\Exception('Malformed htdigest file. Every line should contain 2 colons');
- list($username,$realm,$A1) = explode(':',$line);
+ list($username, $realm, $A1) = explode(':', $line);
if (!preg_match('/^[a-zA-Z0-9]{32}$/', $A1))
throw new DAV\Exception('Malformed htdigest file. Invalid md5 hash');
@@ -70,7 +70,7 @@ class File extends AbstractDigest {
*/
function getDigestHash($realm, $username) {
- return isset($this->users[$realm . ':' . $username])?$this->users[$realm . ':' . $username]:false;
+ return isset($this->users[$realm . ':' . $username]) ? $this->users[$realm . ':' . $username] : false;
}
diff --git a/lib/DAV/Auth/Backend/PDO.php b/lib/DAV/Auth/Backend/PDO.php
index ee79f73..633a545 100644
--- a/lib/DAV/Auth/Backend/PDO.php
+++ b/lib/DAV/Auth/Backend/PDO.php
@@ -46,9 +46,9 @@ class PDO extends AbstractDigest {
* @param string $username
* @return string|null
*/
- function getDigestHash($realm,$username) {
+ function getDigestHash($realm, $username) {
- $stmt = $this->pdo->prepare('SELECT digesta1 FROM '.$this->tableName.' WHERE username = ?');
+ $stmt = $this->pdo->prepare('SELECT digesta1 FROM ' . $this->tableName . ' WHERE username = ?');
$stmt->execute([$username]);
return $stmt->fetchColumn() ?: null;
diff --git a/lib/DAV/Auth/Plugin.php b/lib/DAV/Auth/Plugin.php
index 6744576..444fca4 100644
--- a/lib/DAV/Auth/Plugin.php
+++ b/lib/DAV/Auth/Plugin.php
@@ -2,14 +2,12 @@
namespace Sabre\DAV\Auth;
-use
- Sabre\HTTP\RequestInterface,
- Sabre\HTTP\ResponseInterface,
- Sabre\HTTP\URLUtil,
- Sabre\DAV\Exception\NotAuthenticated,
- Sabre\DAV\Server,
- Sabre\DAV\ServerPlugin;
-
+use Sabre\HTTP\RequestInterface;
+use Sabre\HTTP\ResponseInterface;
+use Sabre\HTTP\URLUtil;
+use Sabre\DAV\Exception\NotAuthenticated;
+use Sabre\DAV\Server;
+use Sabre\DAV\ServerPlugin;
/**
* This plugin provides Authentication for a WebDAV server.
@@ -73,7 +71,7 @@ class Plugin extends ServerPlugin {
*/
function initialize(Server $server) {
- $server->on('beforeMethod', [$this,'beforeMethod'], 10);
+ $server->on('beforeMethod', [$this, 'beforeMethod'], 10);
}
@@ -143,14 +141,14 @@ class Plugin extends ServerPlugin {
throw new \Sabre\DAV\Exception('No authentication backends were configured on this server.');
}
$reasons = [];
- foreach($this->backends as $backend) {
+ foreach ($this->backends as $backend) {
$result = $backend->check(
$request,
$response
);
- if (!is_array($result) || count($result)!==2 || !is_bool($result[0]) || !is_string($result[1])) {
+ if (!is_array($result) || count($result) !== 2 || !is_bool($result[0]) || !is_string($result[1])) {
throw new \Sabre\DAV\Exception('The authentication backend did not return a correct value from the check() method.');
}
@@ -167,7 +165,7 @@ class Plugin extends ServerPlugin {
// successful in authenticating the user.
$this->currentPrincipal = null;
- foreach($this->backends as $backend) {
+ foreach ($this->backends as $backend) {
$backend->challenge($request, $response);
}
throw new NotAuthenticated(implode(', ', $reasons));
diff --git a/lib/DAV/Browser/GuessContentType.php b/lib/DAV/Browser/GuessContentType.php
index c9182db..17287db 100644
--- a/lib/DAV/Browser/GuessContentType.php
+++ b/lib/DAV/Browser/GuessContentType.php
@@ -2,11 +2,10 @@
namespace Sabre\DAV\Browser;
-use
- Sabre\HTTP\URLUtil,
- Sabre\DAV,
- Sabre\DAV\PropFind,
- Sabre\DAV\Inode;
+use Sabre\HTTP\URLUtil;
+use Sabre\DAV;
+use Sabre\DAV\PropFind;
+use Sabre\DAV\Inode;
/**
* GuessContentType plugin
@@ -58,7 +57,7 @@ class GuessContentType extends DAV\ServerPlugin {
// Using a relatively low priority (200) to allow other extensions
// to set the content-type first.
- $server->on('propFind', [$this,'propFind'], 200);
+ $server->on('propFind', [$this, 'propFind'], 200);
}
@@ -91,7 +90,7 @@ class GuessContentType extends DAV\ServerPlugin {
protected function getContentType($fileName) {
// Just grabbing the extension
- $extension = strtolower(substr($fileName,strrpos($fileName,'.')+1));
+ $extension = strtolower(substr($fileName, strrpos($fileName, '.') + 1));
if (isset($this->extensionMap[$extension])) {
return $this->extensionMap[$extension];
}
diff --git a/lib/DAV/Browser/MapGetToPropFind.php b/lib/DAV/Browser/MapGetToPropFind.php
index fe78b0d..1b47b7e 100644
--- a/lib/DAV/Browser/MapGetToPropFind.php
+++ b/lib/DAV/Browser/MapGetToPropFind.php
@@ -2,10 +2,9 @@
namespace Sabre\DAV\Browser;
-use
- Sabre\DAV,
- Sabre\HTTP\RequestInterface,
- Sabre\HTTP\ResponseInterface;
+use Sabre\DAV;
+use Sabre\HTTP\RequestInterface;
+use Sabre\HTTP\ResponseInterface;
/**
* This is a simple plugin that will map any GET request for non-files to
@@ -35,7 +34,7 @@ class MapGetToPropFind extends DAV\ServerPlugin {
function initialize(DAV\Server $server) {
$this->server = $server;
- $this->server->on('method:GET', [$this,'httpGet'], 90);
+ $this->server->on('method:GET', [$this, 'httpGet'], 90);
}
/**
@@ -53,7 +52,7 @@ class MapGetToPropFind extends DAV\ServerPlugin {
$subRequest = clone $request;
$subRequest->setMethod('PROPFIND');
- $this->server->invokeMethod($subRequest,$response);
+ $this->server->invokeMethod($subRequest, $response);
return false;
}
diff --git a/lib/DAV/Browser/Plugin.php b/lib/DAV/Browser/Plugin.php
index fa96968..bc0f51f 100644
--- a/lib/DAV/Browser/Plugin.php
+++ b/lib/DAV/Browser/Plugin.php
@@ -2,12 +2,11 @@
namespace Sabre\DAV\Browser;
-use
- Sabre\DAV,
- Sabre\DAV\MkCol,
- Sabre\HTTP\URLUtil,
- Sabre\HTTP\RequestInterface,
- Sabre\HTTP\ResponseInterface;
+use Sabre\DAV;
+use Sabre\DAV\MkCol;
+use Sabre\HTTP\URLUtil;
+use Sabre\HTTP\RequestInterface;
+use Sabre\HTTP\ResponseInterface;
/**
* Browser Plugin
@@ -61,7 +60,7 @@ class Plugin extends DAV\ServerPlugin {
*
* @param bool $enablePost
*/
- function __construct($enablePost=true) {
+ function __construct($enablePost = true) {
$this->enablePost = $enablePost;
@@ -76,10 +75,10 @@ class Plugin extends DAV\ServerPlugin {
function initialize(DAV\Server $server) {
$this->server = $server;
- $this->server->on('method:GET', [$this,'httpGetEarly'], 90);
- $this->server->on('method:GET', [$this,'httpGet'], 200);
- $this->server->on('onHTMLActionsPanel', [$this, 'htmlActionsPanel'],200);
- if ($this->enablePost) $this->server->on('method:POST', [$this,'httpPOST']);
+ $this->server->on('method:GET', [$this, 'httpGetEarly'], 90);
+ $this->server->on('method:GET', [$this, 'httpGet'], 200);
+ $this->server->on('onHTMLActionsPanel', [$this, 'htmlActionsPanel'], 200);
+ if ($this->enablePost) $this->server->on('method:POST', [$this, 'httpPOST']);
}
/**
@@ -93,8 +92,8 @@ class Plugin extends DAV\ServerPlugin {
function httpGetEarly(RequestInterface $request, ResponseInterface $response) {
$params = $request->getQueryParameters();
- if (isset($params['sabreAction']) && $params['sabreAction']==='info') {
- return $this->httpGet($request,$response);
+ if (isset($params['sabreAction']) && $params['sabreAction'] === 'info') {
+ return $this->httpGet($request, $response);
}
}
@@ -115,13 +114,13 @@ class Plugin extends DAV\ServerPlugin {
// CSP headers
$this->server->httpResponse->setHeader('Content-Security-Policy', "img-src 'self'; style-src 'self';");
- $sabreAction = isset($getVars['sabreAction'])?$getVars['sabreAction']:null;
+ $sabreAction = isset($getVars['sabreAction']) ? $getVars['sabreAction'] : null;
- switch($sabreAction) {
+ switch ($sabreAction) {
case 'asset' :
// Asset handling, such as images
- $this->serveAsset(isset($getVars['assetName'])?$getVars['assetName']:null);
+ $this->serveAsset(isset($getVars['assetName']) ? $getVars['assetName'] : null);
return false;
default :
case 'info' :
@@ -134,7 +133,7 @@ class Plugin extends DAV\ServerPlugin {
}
$response->setStatus(200);
- $response->setHeader('Content-Type','text/html; charset=utf-8');
+ $response->setHeader('Content-Type', 'text/html; charset=utf-8');
$response->setBody(
$this->generateDirectoryIndex($request->getPath())
@@ -144,7 +143,7 @@ class Plugin extends DAV\ServerPlugin {
case 'plugins' :
$response->setStatus(200);
- $response->setHeader('Content-Type','text/html; charset=utf-8');
+ $response->setHeader('Content-Type', 'text/html; charset=utf-8');
$response->setBody(
$this->generatePluginListing()
@@ -180,7 +179,7 @@ class Plugin extends DAV\ServerPlugin {
if ($this->server->emit('onBrowserPostAction', [$uri, $postVars['sabreAction'], $postVars])) {
- switch($postVars['sabreAction']) {
+ switch ($postVars['sabreAction']) {
case 'mkcol' :
if (isset($postVars['name']) && trim($postVars['name'])) {
@@ -188,13 +187,13 @@ class Plugin extends DAV\ServerPlugin {
list(, $folderName) = URLUtil::splitPath(trim($postVars['name']));
if (isset($postVars['resourceType'])) {
- $resourceType = explode(',',$postVars['resourceType']);
+ $resourceType = explode(',', $postVars['resourceType']);
} else {
$resourceType = ['{DAV:}collection'];
}
$properties = [];
- foreach($postVars as $varName => $varValue) {
+ foreach ($postVars as $varName => $varValue) {
// Any _POST variable in clark notation is treated
// like a property.
if ($varName[0] === '{') {
@@ -231,7 +230,7 @@ class Plugin extends DAV\ServerPlugin {
list(, $newName) = URLUtil::splitPath($newName);
if (is_uploaded_file($file['tmp_name'])) {
- $this->server->createFile($uri . '/' . $newName, fopen($file['tmp_name'],'r'));
+ $this->server->createFile($uri . '/' . $newName, fopen($file['tmp_name'], 'r'));
}
break;
// @codeCoverageIgnoreEnd
@@ -253,7 +252,7 @@ class Plugin extends DAV\ServerPlugin {
*/
function escapeHTML($value) {
- return htmlspecialchars($value,ENT_QUOTES,'UTF-8');
+ return htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
}
@@ -265,13 +264,13 @@ class Plugin extends DAV\ServerPlugin {
*/
function generateDirectoryIndex($path) {
- $html = $this->generateHeader($path?$path:'/', $path);
+ $html = $this->generateHeader($path ? $path : '/', $path);
$node = $this->server->tree->getNodeForPath($path);
if ($node instanceof DAV\ICollection) {
- $html.="<section><h1>Nodes</h1>\n";
- $html.="<table class=\"nodeTable\">";
+ $html .= "<section><h1>Nodes</h1>\n";
+ $html .= "<table class=\"nodeTable\">";
$subNodes = $this->server->getPropertiesForChildren($path, [
'{DAV:}displayname',
@@ -281,7 +280,7 @@ class Plugin extends DAV\ServerPlugin {
'{DAV:}getlastmodified',
]);
- foreach($subNodes as $subPath=>$subProps) {
+ foreach ($subNodes as $subPath => $subProps) {
$subNode = $this->server->tree->getNodeForPath($subPath);
$fullPath = $this->server->getBaseUri() . URLUtil::encodePath($subPath);
@@ -293,7 +292,7 @@ class Plugin extends DAV\ServerPlugin {
}
uasort($subNodes, [$this, 'compareNodes']);
- foreach($subNodes as $subProps) {
+ foreach ($subNodes as $subProps) {
$type = [
'string' => 'Unknown',
'icon' => 'cog',
@@ -302,19 +301,19 @@ class Plugin extends DAV\ServerPlugin {
$type = $this->mapResourceType($subProps['{DAV:}resourcetype']->getValue(), $subProps['subNode']);
}
- $html.= '<tr>';
- $html.= '<td class="nameColumn"><a href="' . $this->escapeHTML($subProps['fullPath']) . '"><span class="oi" data-glyph="'.$this->escapeHTML($type['icon']).'"></span> ' . $this->escapeHTML($subProps['displayPath']) . '</a></td>';
- $html.= '<td class="typeColumn">' . $this->escapeHTML($type['string']) . '</td>';
- $html.= '<td>';
+ $html .= '<tr>';
+ $html .= '<td class="nameColumn"><a href="' . $this->escapeHTML($subProps['fullPath']) . '"><span class="oi" data-glyph="' . $this->escapeHTML($type['icon']) . '"></span> ' . $this->escapeHTML($subProps['displayPath']) . '</a></td>';
+ $html .= '<td class="typeColumn">' . $this->escapeHTML($type['string']) . '</td>';
+ $html .= '<td>';
if (isset($subProps['{DAV:}getcontentlength'])) {
- $html.=$this->escapeHTML($subProps['{DAV:}getcontentlength'] . ' bytes');
+ $html .= $this->escapeHTML($subProps['{DAV:}getcontentlength'] . ' bytes');
}
- $html.= '</td><td>';
+ $html .= '</td><td>';
if (isset($subProps['{DAV:}getlastmodified'])) {
$lastMod = $subProps['{DAV:}getlastmodified']->getTime();
- $html.=$this->escapeHTML($lastMod->format('F j, Y, g:i a'));
+ $html .= $this->escapeHTML($lastMod->format('F j, Y, g:i a'));
}
- $html.= '</td>';
+ $html .= '</td>';
$buttonActions = '';
if ($subNode instanceof DAV\IFile) {
@@ -322,17 +321,17 @@ class Plugin extends DAV\ServerPlugin {
}
$this->server->emit('browserButtonActions', [$subProps['fullPath'], $subProps['subNode'], &$buttonActions]);
- $html.= '<td>'. $buttonActions . '</td>';
- $html.= '</tr>';
+ $html .= '<td>' . $buttonActions . '</td>';
+ $html .= '</tr>';
}
- $html.= '</table>';
+ $html .= '</table>';
}
- $html.="</section>";
- $html.="<section><h1>Properties</h1>";
- $html.="<table class=\"propTable\">";
+ $html .= "</section>";
+ $html .= "<section><h1>Properties</h1>";
+ $html .= "<table class=\"propTable\">";
// Allprops request
$propFind = new PropFindAll($path);
@@ -340,16 +339,16 @@ class Plugin extends DAV\ServerPlugin {
$properties = $propFind->getResultForMultiStatus()[200];
- foreach($properties as $propName => $propValue) {
+ foreach ($properties as $propName => $propValue) {
if (!in_array($propName, $this->uninterestingProperties)) {
- $html.=$this->drawPropertyRow($propName, $propValue);
+ $html .= $this->drawPropertyRow($propName, $propValue);
}
}
- $html.="</table>";
- $html.="</section>";
+ $html .= "</table>";
+ $html .= "</section>";
/* Start of generating actions */
@@ -360,14 +359,14 @@ class Plugin extends DAV\ServerPlugin {
if ($output) {
- $html.="<section><h1>Actions</h1>";
- $html.="<div class=\"actions\">\n";
- $html.=$output;
- $html.="</div>\n";
- $html.="</section>\n";
+ $html .= "<section><h1>Actions</h1>";
+ $html .= "<div class=\"actions\">\n";
+ $html .= $output;
+ $html .= "</div>\n";
+ $html .= "</section>\n";
}
- $html.=$this->generateFooter();
+ $html .= $this->generateFooter();
$this->server->httpResponse->setHeader('Content-Security-Policy', "img-src 'self'; style-src 'self';");
@@ -384,24 +383,24 @@ class Plugin extends DAV\ServerPlugin {
$html = $this->generateHeader('Plugins');
- $html.="<section><h1>Plugins</h1>";
- $html.="<table class=\"propTable\">";
- foreach($this->server->getPlugins() as $plugin) {
+ $html .= "<section><h1>Plugins</h1>";
+ $html .= "<table class=\"propTable\">";
+ foreach ($this->server->getPlugins() as $plugin) {
$info = $plugin->getPluginInfo();
- $html.='<tr><th>' . $info['name'] . '</th>';
- $html.='<td>' . $info['description'] . '</td>';
- $html.='<td>';
+ $html .= '<tr><th>' . $info['name'] . '</th>';
+ $html .= '<td>' . $info['description'] . '</td>';
+ $html .= '<td>';
if (isset($info['link']) && $info['link']) {
- $html.='<a href="' . $this->escapeHTML($info['link']) . '"><span class="oi" data-glyph="book"></span></a>';
+ $html .= '<a href="' . $this->escapeHTML($info['link']) . '"><span class="oi" data-glyph="book"></span></a>';
}
- $html.='</td></tr>';
+ $html .= '</td></tr>';
}
- $html.="</table>";
- $html.="</section>";
+ $html .= "</table>";
+ $html .= "</section>";
/* Start of generating actions */
- $html.=$this->generateFooter();
+ $html .= $this->generateFooter();
return $html;
@@ -444,14 +443,14 @@ HTML;
if ($path) {
list($parentUri) = URLUtil::splitPath($path);
$fullPath = $this->server->getBaseUri() . URLUtil::encodePath($parentUri);
- $html.='<a href="' . $fullPath . '" class="btn">⇤ Go to parent</a>';
+ $html .= '<a href="' . $fullPath . '" class="btn">⇤ Go to parent</a>';
} else {
- $html.='<span class="btn disabled">⇤ Go to parent</span>';
+ $html .= '<span class="btn disabled">⇤ Go to parent</span>';
}
- $html.= ' <a href="?sabreAction=plugins" class="btn"><span class="oi" data-glyph="puzzle-piece"></span> Plugins</a>';
+ $html .= ' <a href="?sabreAction=plugins" class="btn"><span class="oi" data-glyph="puzzle-piece"></span> Plugins</a>';
- $html.="</nav>";
+ $html .= "</nav>";
return $html;
@@ -486,7 +485,7 @@ HTML;
// We also know fairly certain that if an object is a non-extended
// SimpleCollection, we won't need to show the panel either.
- if (get_class($node)==='Sabre\\DAV\\SimpleCollection')
+ if (get_class($node) === 'Sabre\\DAV\\SimpleCollection')
return;
ob_start();
@@ -505,7 +504,7 @@ HTML;
</form>
';
- $output.=ob_get_clean();
+ $output .= ob_get_clean();
}
@@ -560,10 +559,10 @@ HTML;
$map = [
'ico' => 'image/vnd.microsoft.icon',
'png' => 'image/png',
- 'css' => 'text/css',
+ 'css' => 'text/css',
];
- $ext = substr($assetName, strrpos($assetName, '.')+1);
+ $ext = substr($assetName, strrpos($assetName, '.') + 1);
if (isset($map[$ext])) {
$mime = $map[$ext];
}
@@ -572,7 +571,7 @@ HTML;
$this->server->httpResponse->setHeader('Content-Length', filesize($assetPath));
$this->server->httpResponse->setHeader('Cache-Control', 'public, max-age=1209600');
$this->server->httpResponse->setStatus(200);
- $this->server->httpResponse->setBody(fopen($assetPath,'r'));
+ $this->server->httpResponse->setBody(fopen($assetPath, 'r'));
}
@@ -674,16 +673,16 @@ HTML;
$info = [
'string' => [],
- 'icon' => 'cog',
+ 'icon' => 'cog',
];
- foreach($resourceTypes as $k=> $resourceType) {
+ foreach ($resourceTypes as $k => $resourceType) {
if (isset($types[$resourceType])) {
$info['string'][] = $types[$resourceType]['string'];
} else {
$info['string'][] = $resourceType;
}
}
- foreach($types as $key=>$resourceInfo) {
+ foreach ($types as $key => $resourceInfo) {
if (in_array($key, $resourceTypes)) {
$info['icon'] = $resourceInfo['icon'];
break;
@@ -709,7 +708,7 @@ HTML;
$this->server->xml->namespaceMap
);
- return "<tr><th>". $html->xmlName($name). "</th><td>". $this->drawPropertyValue($html, $value). "</td></tr>";
+ return "<tr><th>" . $html->xmlName($name) . "</th><td>" . $this->drawPropertyValue($html, $value) . "</td></tr>";
}
@@ -726,7 +725,7 @@ HTML;
return $html->h($value);
} elseif ($value instanceof HtmlOutput) {
return $value->toHtml($html);
- } elseif($value instanceof \Sabre\Xml\XmlSerializable) {
+ } elseif ($value instanceof \Sabre\Xml\XmlSerializable) {
// There's no default html output for this property, we're going
// to output the actual xml serialization instead.
diff --git a/lib/DAV/Browser/PropFindAll.php b/lib/DAV/Browser/PropFindAll.php
index 9e4845e..b923266 100644
--- a/lib/DAV/Browser/PropFindAll.php
+++ b/lib/DAV/Browser/PropFindAll.php
@@ -88,7 +88,7 @@ class PropFindAll extends PropFind {
*/
function get($propertyName) {
- return isset($this->result[$propertyName])?$this->result[$propertyName][1]:null;
+ return isset($this->result[$propertyName]) ? $this->result[$propertyName][1] : null;
}
@@ -103,7 +103,7 @@ class PropFindAll extends PropFind {
*/
function getStatus($propertyName) {
- return isset($this->result[$propertyName])?$this->result[$propertyName][0]:404;
+ return isset($this->result[$propertyName]) ? $this->result[$propertyName][0] : 404;
}
@@ -116,8 +116,8 @@ class PropFindAll extends PropFind {
function get404Properties() {
$result = [];
- foreach($this->result as $propertyName=>$stuff) {
- if ($stuff[0]===404) {
+ foreach ($this->result as $propertyName => $stuff) {
+ if ($stuff[0] === 404) {
$result[] = $propertyName;
}
}
diff --git a/lib/DAV/Client.php b/lib/DAV/Client.php
index ac31bdc..e4473f4 100644
--- a/lib/DAV/Client.php
+++ b/lib/DAV/Client.php
@@ -109,7 +109,7 @@ class Client extends HTTP\Client {
if (isset($settings['userName'])) {
$userName = $settings['userName'];
- $password = isset($settings['password'])?$settings['password']:'';
+ $password = isset($settings['password']) ? $settings['password'] : '';
if (isset($settings['authType'])) {
$curlType = 0;
@@ -176,7 +176,7 @@ class Client extends HTTP\Client {
$root = $dom->createElementNS('DAV:', 'd:propfind');
$prop = $dom->createElement('d:prop');
- foreach($properties as $property) {
+ foreach ($properties as $property) {
list(
$namespace,
@@ -184,21 +184,21 @@ class Client extends HTTP\Client {
) = \Sabre\Xml\Service::parseClarkNotation($property);
if ($namespace === 'DAV:') {
- $element = $dom->createElement('d:'.$elementName);
+ $element = $dom->createElement('d:' . $elementName);
} else {
- $element = $dom->createElementNS($namespace, 'x:'.$elementName);
+ $element = $dom->createElementNS($namespace, 'x:' . $elementName);
}
- $prop->appendChild( $element );
+ $prop->appendChild($element);
}
- $dom->appendChild($root)->appendChild( $prop );
+ $dom->appendChild($root)->appendChild($prop);
$body = $dom->saveXML();
$url = $this->getAbsoluteUrl($url);
$request = new HTTP\Request('PROPFIND', $url, [
- 'Depth' => $depth,
+ 'Depth' => $depth,
'Content-Type' => 'application/xml'
], $body);
@@ -211,16 +211,16 @@ class Client extends HTTP\Client {
$result = $this->parseMultiStatus($response->getBodyAsString());
// If depth was 0, we only return the top item
- if ($depth===0) {
+ if ($depth === 0) {
reset($result);
$result = current($result);
- return isset($result[200])?$result[200]:[];
+ return isset($result[200]) ? $result[200] : [];
}
$newResult = [];
- foreach($result as $href => $statusList) {
+ foreach ($result as $href => $statusList) {
- $newResult[$href] = isset($statusList[200])?$statusList[200]:[];
+ $newResult[$href] = isset($statusList[200]) ? $statusList[200] : [];
}
@@ -245,7 +245,7 @@ class Client extends HTTP\Client {
$dom->formatOutput = true;
$root = $dom->createElementNS('DAV:', 'd:propertyupdate');
- foreach($properties as $propName => $propValue) {
+ foreach ($properties as $propName => $propValue) {
list(
$namespace,
@@ -258,12 +258,12 @@ class Client extends HTTP\Client {
$prop = $dom->createElement('d:prop');
if ($namespace === 'DAV:') {
- $element = $dom->createElement('d:'.$elementName);
+ $element = $dom->createElement('d:' . $elementName);
} else {
- $element = $dom->createElementNS($namespace, 'x:'.$elementName);
+ $element = $dom->createElementNS($namespace, 'x:' . $elementName);
}
- $root->appendChild( $remove )->appendChild( $prop )->appendChild( $element );
+ $root->appendChild($remove)->appendChild($prop)->appendChild($element);
} else {
@@ -271,18 +271,18 @@ class Client extends HTTP\Client {
$prop = $dom->createElement('d:prop');
if ($namespace === 'DAV:') {
- $element = $dom->createElement('d:'.$elementName);
+ $element = $dom->createElement('d:' . $elementName);
} else {
- $element = $dom->createElementNS($namespace, 'x:'.$elementName);
+ $element = $dom->createElementNS($namespace, 'x:' . $elementName);
}
- if ( $propValue instanceof Property ) {
- $propValue->serialize( new Server, $element );
+ if ($propValue instanceof Property) {
+ $propValue->serialize(new Server(), $element);
} else {
$element->nodeValue = htmlspecialchars($propValue, ENT_NOQUOTES, 'UTF-8');
}
- $root->appendChild( $set )->appendChild( $prop )->appendChild( $element );
+ $root->appendChild($set)->appendChild($prop)->appendChild($element);
}
@@ -318,7 +318,7 @@ class Client extends HTTP\Client {
}
$features = explode(',', $dav);
- foreach($features as &$v) {
+ foreach ($features as &$v) {
$v = trim($v);
}
return $features;
@@ -360,9 +360,9 @@ class Client extends HTTP\Client {
$response = $this->send(new HTTP\Request($method, $url, $headers, $body));
return [
- 'body' => $response->getBodyAsString(),
+ 'body' => $response->getBodyAsString(),
'statusCode' => (int)$response->getStatus(),
- 'headers' => array_change_key_case($response->getHeaders()),
+ 'headers' => array_change_key_case($response->getHeaders()),
];
}
@@ -383,9 +383,9 @@ class Client extends HTTP\Client {
// If the url starts with a slash, we must calculate the url based off
// the root of the base url.
- if (strpos($url,'/') === 0) {
+ if (strpos($url, '/') === 0) {
$parts = parse_url($this->baseUri);
- return $parts['scheme'] . '://' . $parts['host'] . (isset($parts['port'])?':' . $parts['port']:'') . $url;
+ return $parts['scheme'] . '://' . $parts['host'] . (isset($parts['port']) ? ':' . $parts['port'] : '') . $url;
}
// Otherwise...
@@ -425,7 +425,7 @@ class Client extends HTTP\Client {
$result = [];
- foreach($multistatus->getResponses() as $response) {
+ foreach ($multistatus->getResponses() as $response) {
$result[$response->getHref()] = $response->getResponseProperties();
diff --git a/lib/DAV/Collection.php b/lib/DAV/Collection.php
index 661d982..aac852e 100644
--- a/lib/DAV/Collection.php
+++ b/lib/DAV/Collection.php
@@ -30,9 +30,9 @@ abstract class Collection extends Node implements ICollection {
*/
function getChild($name) {
- foreach($this->getChildren() as $child) {
+ foreach ($this->getChildren() as $child) {
- if ($child->getName()==$name) return $child;
+ if ($child->getName() == $name) return $child;
}
throw new Exception\NotFound('File not found: ' . $name);
@@ -54,7 +54,7 @@ abstract class Collection extends Node implements ICollection {
$this->getChild($name);
return true;
- } catch(Exception\NotFound $e) {
+ } catch (Exception\NotFound $e) {
return false;
@@ -107,4 +107,3 @@ abstract class Collection extends Node implements ICollection {
}
-
diff --git a/lib/DAV/CorePlugin.php b/lib/DAV/CorePlugin.php
index 32534d0..e8277d9 100644
--- a/lib/DAV/CorePlugin.php
+++ b/lib/DAV/CorePlugin.php
@@ -452,7 +452,7 @@ class CorePlugin extends ServerPlugin {
// Intercepting Content-Range
if ($request->getHeader('Content-Range')) {
- /**
+ /*
An origin server that allows PUT on a given target resource MUST send
a 400 (Bad Request) response to a PUT request that contains a
Content-Range header field.
@@ -465,7 +465,7 @@ class CorePlugin extends ServerPlugin {
// Intercepting the Finder problem
if (($expected = $request->getHeader('X-Expected-Entity-Length')) && $expected > 0) {
- /**
+ /*
Many webservers will not cooperate well with Finder PUT requests,
because it uses 'Chunked' transfer encoding for the request body.
diff --git a/lib/DAV/Exception.php b/lib/DAV/Exception.php
index 4135f00..228dd3f 100644
--- a/lib/DAV/Exception.php
+++ b/lib/DAV/Exception.php
@@ -9,7 +9,6 @@
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-
namespace Sabre\DAV;
/**
@@ -41,7 +40,7 @@ class Exception extends \Exception {
* @param \DOMElement $errorNode
* @return void
*/
- function serialize(Server $server,\DOMElement $errorNode) {
+ function serialize(Server $server, \DOMElement $errorNode) {
}
@@ -61,4 +60,3 @@ class Exception extends \Exception {
}
}
-
diff --git a/lib/DAV/Exception/ConflictingLock.php b/lib/DAV/Exception/ConflictingLock.php
index 30c3f9a..0fcfd77 100644
--- a/lib/DAV/Exception/ConflictingLock.php
+++ b/lib/DAV/Exception/ConflictingLock.php
@@ -26,9 +26,9 @@ class ConflictingLock extends Locked {
function serialize(DAV\Server $server, \DOMElement $errorNode) {
if ($this->lock) {
- $error = $errorNode->ownerDocument->createElementNS('DAV:','d:no-conflicting-lock');
+ $error = $errorNode->ownerDocument->createElementNS('DAV:', 'd:no-conflicting-lock');
$errorNode->appendChild($error);
- $error->appendChild($errorNode->ownerDocument->createElementNS('DAV:','d:href',$this->lock->uri));
+ $error->appendChild($errorNode->ownerDocument->createElementNS('DAV:', 'd:href', $this->lock->uri));
}
}
diff --git a/lib/DAV/Exception/InvalidResourceType.php b/lib/DAV/Exception/InvalidResourceType.php
index 4a9f981..24162ab 100644
--- a/lib/DAV/Exception/InvalidResourceType.php
+++ b/lib/DAV/Exception/InvalidResourceType.php
@@ -23,9 +23,9 @@ class InvalidResourceType extends Forbidden {
* @param \DOMElement $errorNode
* @return void
*/
- function serialize(\Sabre\DAV\Server $server,\DOMElement $errorNode) {
+ function serialize(\Sabre\DAV\Server $server, \DOMElement $errorNode) {
- $error = $errorNode->ownerDocument->createElementNS('DAV:','d:valid-resourcetype');
+ $error = $errorNode->ownerDocument->createElementNS('DAV:', 'd:valid-resourcetype');
$errorNode->appendChild($error);
}
diff --git a/lib/DAV/Exception/InvalidSyncToken.php b/lib/DAV/Exception/InvalidSyncToken.php
index d0fecda..90e5283 100644
--- a/lib/DAV/Exception/InvalidSyncToken.php
+++ b/lib/DAV/Exception/InvalidSyncToken.php
@@ -28,9 +28,9 @@ class InvalidSyncToken extends Forbidden {
* @param \DOMElement $errorNode
* @return void
*/
- function serialize(DAV\Server $server,\DOMElement $errorNode) {
+ function serialize(DAV\Server $server, \DOMElement $errorNode) {
- $error = $errorNode->ownerDocument->createElementNS('DAV:','d:valid-sync-token');
+ $error = $errorNode->ownerDocument->createElementNS('DAV:', 'd:valid-sync-token');
$errorNode->appendChild($error);
}
diff --git a/lib/DAV/Exception/LockTokenMatchesRequestUri.php b/lib/DAV/Exception/LockTokenMatchesRequestUri.php
index c664fc3..b3e4d1d 100644
--- a/lib/DAV/Exception/LockTokenMatchesRequestUri.php
+++ b/lib/DAV/Exception/LockTokenMatchesRequestUri.php
@@ -31,9 +31,9 @@ class LockTokenMatchesRequestUri extends Conflict {
* @param \DOMElement $errorNode
* @return void
*/
- function serialize(DAV\Server $server,\DOMElement $errorNode) {
+ function serialize(DAV\Server $server, \DOMElement $errorNode) {
- $error = $errorNode->ownerDocument->createElementNS('DAV:','d:lock-token-matches-request-uri');
+ $error = $errorNode->ownerDocument->createElementNS('DAV:', 'd:lock-token-matches-request-uri');
$errorNode->appendChild($error);
}
diff --git a/lib/DAV/Exception/Locked.php b/lib/DAV/Exception/Locked.php
index eadbf58..4b8a109 100644
--- a/lib/DAV/Exception/Locked.php
+++ b/lib/DAV/Exception/Locked.php
@@ -54,13 +54,13 @@ class Locked extends DAV\Exception {
* @param \DOMElement $errorNode
* @return void
*/
- function serialize(DAV\Server $server,\DOMElement $errorNode) {
+ function serialize(DAV\Server $server, \DOMElement $errorNode) {
if ($this->lock) {
- $error = $errorNode->ownerDocument->createElementNS('DAV:','d:lock-token-submitted');
+ $error = $errorNode->ownerDocument->createElementNS('DAV:', 'd:lock-token-submitted');
$errorNode->appendChild($error);
- $href = $errorNode->ownerDocument->createElementNS('DAV:','d:href');
+ $href = $errorNode->ownerDocument->createElementNS('DAV:', 'd:href');
$href->appendChild($errorNode->ownerDocument->createTextNode($this->lock->uri));
$error->appendChild(
$href
@@ -70,4 +70,3 @@ class Locked extends DAV\Exception {
}
}
-
diff --git a/lib/DAV/Exception/MethodNotAllowed.php b/lib/DAV/Exception/MethodNotAllowed.php
index f359bca..8685aee 100644
--- a/lib/DAV/Exception/MethodNotAllowed.php
+++ b/lib/DAV/Exception/MethodNotAllowed.php
@@ -39,7 +39,7 @@ class MethodNotAllowed extends DAV\Exception {
$methods = $server->getAllowedMethods($server->getRequestUri());
return [
- 'Allow' => strtoupper(implode(', ',$methods)),
+ 'Allow' => strtoupper(implode(', ', $methods)),
];
}
diff --git a/lib/DAV/Exception/NotFound.php b/lib/DAV/Exception/NotFound.php
index 6f17624..5da8f03 100644
--- a/lib/DAV/Exception/NotFound.php
+++ b/lib/DAV/Exception/NotFound.php
@@ -27,4 +27,3 @@ class NotFound extends DAV\Exception {
}
}
-
diff --git a/lib/DAV/Exception/PreconditionFailed.php b/lib/DAV/Exception/PreconditionFailed.php
index 1c5014d..5c92bab 100644
--- a/lib/DAV/Exception/PreconditionFailed.php
+++ b/lib/DAV/Exception/PreconditionFailed.php
@@ -33,7 +33,7 @@ class PreconditionFailed extends DAV\Exception {
* @param string $message
* @param string $header
*/
- function __construct($message, $header=null) {
+ function __construct($message, $header = null) {
parent::__construct($message);
$this->header = $header;
@@ -58,7 +58,7 @@ class PreconditionFailed extends DAV\Exception {
* @param \DOMElement $errorNode
* @return void
*/
- function serialize(DAV\Server $server,\DOMElement $errorNode) {
+ function serialize(DAV\Server $server, \DOMElement $errorNode) {
if ($this->header) {
$prop = $errorNode->ownerDocument->createElement('s:header');
diff --git a/lib/DAV/Exception/ReportNotSupported.php b/lib/DAV/Exception/ReportNotSupported.php
index 9adde06..6adaeac 100644
--- a/lib/DAV/Exception/ReportNotSupported.php
+++ b/lib/DAV/Exception/ReportNotSupported.php
@@ -22,9 +22,9 @@ class ReportNotSupported extends UnsupportedMediaType {
* @param \DOMElement $errorNode
* @return void
*/
- function serialize(DAV\Server $server,\DOMElement $errorNode) {
+ function serialize(DAV\Server $server, \DOMElement $errorNode) {
- $error = $errorNode->ownerDocument->createElementNS('DAV:','d:supported-report');
+ $error = $errorNode->ownerDocument->createElementNS('DAV:', 'd:supported-report');
$errorNode->appendChild($error);
}
diff --git a/lib/DAV/Exception/RequestedRangeNotSatisfiable.php b/lib/DAV/Exception/RequestedRangeNotSatisfiable.php
index 7c4b95a..e24d49b 100644
--- a/lib/DAV/Exception/RequestedRangeNotSatisfiable.php
+++ b/lib/DAV/Exception/RequestedRangeNotSatisfiable.php
@@ -28,4 +28,3 @@ class RequestedRangeNotSatisfiable extends DAV\Exception {
}
}
-
diff --git a/lib/DAV/Exception/TooManyMatches.php b/lib/DAV/Exception/TooManyMatches.php
index 1b24183..c2ddc87 100644
--- a/lib/DAV/Exception/TooManyMatches.php
+++ b/lib/DAV/Exception/TooManyMatches.php
@@ -28,9 +28,9 @@ class TooManyMatches extends Forbidden {
* @param \DOMElement $errorNode
* @return void
*/
- function serialize(DAV\Server $server,\DOMElement $errorNode) {
+ function serialize(DAV\Server $server, \DOMElement $errorNode) {
- $error = $errorNode->ownerDocument->createElementNS('DAV:','d:number-of-matches-within-limits');
+ $error = $errorNode->ownerDocument->createElementNS('DAV:', 'd:number-of-matches-within-limits');
$errorNode->appendChild($error);
}
diff --git a/lib/DAV/FS/Directory.php b/lib/DAV/FS/Directory.php
index 1774b67..f1b7ac9 100644
--- a/lib/DAV/FS/Directory.php
+++ b/lib/DAV/FS/Directory.php
@@ -1,6 +1,7 @@
<?php
namespace Sabre\DAV\FS;
+
use Sabre\DAV;
/**
@@ -76,7 +77,7 @@ class Directory extends Node implements DAV\ICollection, DAV\IQuota {
if (is_dir($path)) {
- return new Directory($path);
+ return new self($path);
} else {
@@ -99,7 +100,7 @@ class Directory extends Node implements DAV\ICollection, DAV\IQuota {
\FilesystemIterator::CURRENT_AS_SELF
| \FilesystemIterator::SKIP_DOTS
);
- foreach($iterator as $entry) {
+ foreach ($iterator as $entry) {
$nodes[] = $this->getChild($entry->getFilename());
@@ -128,7 +129,7 @@ class Directory extends Node implements DAV\ICollection, DAV\IQuota {
*/
function delete() {
- foreach($this->getChildren() as $child) $child->delete();
+ foreach ($this->getChildren() as $child) $child->delete();
rmdir($this->path);
}
@@ -141,11 +142,10 @@ class Directory extends Node implements DAV\ICollection, DAV\IQuota {
function getQuotaInfo() {
return [
- disk_total_space($this->path)-disk_free_space($this->path),
+ disk_total_space($this->path) - disk_free_space($this->path),
disk_free_space($this->path)
];
}
}
-
diff --git a/lib/DAV/FS/File.php b/lib/DAV/FS/File.php
index a15d57b..8dd6855 100644
--- a/lib/DAV/FS/File.php
+++ b/lib/DAV/FS/File.php
@@ -21,7 +21,7 @@ class File extends Node implements DAV\IFile {
*/
function put($data) {
- file_put_contents($this->path,$data);
+ file_put_contents($this->path, $data);
clearstatcache(true, $this->path);
}
@@ -33,7 +33,7 @@ class File extends Node implements DAV\IFile {
*/
function get() {
- return fopen($this->path,'r');
+ return fopen($this->path, 'r');
}
@@ -75,7 +75,7 @@ class File extends Node implements DAV\IFile {
fileinode($this->path) .
filesize($this->path) .
filemtime($this->path)
- ). '"';
+ ) . '"';
}
@@ -93,4 +93,3 @@ class File extends Node implements DAV\IFile {
}
}
-
diff --git a/lib/DAV/FS/Node.php b/lib/DAV/FS/Node.php
index 31d9a14..90cda4f 100644
--- a/lib/DAV/FS/Node.php
+++ b/lib/DAV/FS/Node.php
@@ -2,9 +2,8 @@
namespace Sabre\DAV\FS;
-use
- Sabre\DAV,
- Sabre\HTTP\URLUtil;
+use Sabre\DAV;
+use Sabre\HTTP\URLUtil;
/**
* Base node-class
@@ -61,7 +60,7 @@ abstract class Node implements DAV\INode {
list(, $newName) = URLUtil::splitPath($name);
$newPath = $parentPath . '/' . $newName;
- rename($this->path,$newPath);
+ rename($this->path, $newPath);
$this->path = $newPath;
@@ -79,4 +78,3 @@ abstract class Node implements DAV\INode {
}
}
-
diff --git a/lib/DAV/FSExt/Directory.php b/lib/DAV/FSExt/Directory.php
index 60013af..a11d805 100644
--- a/lib/DAV/FSExt/Directory.php
+++ b/lib/DAV/FSExt/Directory.php
@@ -41,16 +41,16 @@ class Directory extends Node implements DAV\ICollection, DAV\IQuota, DAV\IMoveTa
function createFile($name, $data = null) {
// We're not allowing dots
- if ($name=='.' || $name=='..') throw new DAV\Exception\Forbidden('Permission denied to . and ..');
+ if ($name == '.' || $name == '..') throw new DAV\Exception\Forbidden('Permission denied to . and ..');
$newPath = $this->path . '/' . $name;
- file_put_contents($newPath,$data);
+ file_put_contents($newPath, $data);
clearstatcache(true, $newPath);
return '"' . sha1(
fileinode($newPath) .
filesize($newPath) .
filemtime($newPath)
- ). '"';
+ ) . '"';
}
@@ -63,7 +63,7 @@ class Directory extends Node implements DAV\ICollection, DAV\IQuota, DAV\IMoveTa
function createDirectory($name) {
// We're not allowing dots
- if ($name=='.' || $name=='..') throw new DAV\Exception\Forbidden('Permission denied to . and ..');
+ if ($name == '.' || $name == '..') throw new DAV\Exception\Forbidden('Permission denied to . and ..');
$newPath = $this->path . '/' . $name;
mkdir($newPath);
clearstatcache(true, $newPath);
@@ -85,7 +85,7 @@ class Directory extends Node implements DAV\ICollection, DAV\IQuota, DAV\IMoveTa
$path = $this->path . '/' . $name;
if (!file_exists($path)) throw new DAV\Exception\NotFound('File could not be located');
- if ($name=='.' || $name=='..') throw new DAV\Exception\Forbidden('Permission denied to . and ..');
+ if ($name == '.' || $name == '..') throw new DAV\Exception\Forbidden('Permission denied to . and ..');
if (is_dir($path)) {
@@ -107,7 +107,7 @@ class Directory extends Node implements DAV\ICollection, DAV\IQuota, DAV\IMoveTa
*/
function childExists($name) {
- if ($name=='.' || $name=='..')
+ if ($name == '.' || $name == '..')
throw new DAV\Exception\Forbidden('Permission denied to . and ..');
$path = $this->path . '/' . $name;
@@ -129,7 +129,7 @@ class Directory extends Node implements DAV\ICollection, DAV\IQuota, DAV\IMoveTa
| \FilesystemIterator::SKIP_DOTS
);
- foreach($iterator as $entry) {
+ foreach ($iterator as $entry) {
$node = $entry->getFilename();
@@ -151,7 +151,7 @@ class Directory extends Node implements DAV\ICollection, DAV\IQuota, DAV\IMoveTa
function delete() {
// Deleting all children
- foreach($this->getChildren() as $child) $child->delete();
+ foreach ($this->getChildren() as $child) $child->delete();
// Removing resource info, if its still around
if (file_exists($this->path . '/.sabredav')) unlink($this->path . '/.sabredav');
@@ -203,7 +203,7 @@ class Directory extends Node implements DAV\ICollection, DAV\IQuota, DAV\IMoveTa
// We only support FSExt\Directory or FSExt\File objects, so
// anything else we want to quickly reject.
- if (!$sourceNode instanceof Directory && !$sourceNode instanceof File) {
+ if (!$sourceNode instanceof self && !$sourceNode instanceof File) {
return false;
}
@@ -217,4 +217,3 @@ class Directory extends Node implements DAV\ICollection, DAV\IQuota, DAV\IMoveTa
}
}
-
diff --git a/lib/DAV/FSExt/File.php b/lib/DAV/FSExt/File.php
index cc22509..ee2c90d 100644
--- a/lib/DAV/FSExt/File.php
+++ b/lib/DAV/FSExt/File.php
@@ -24,7 +24,7 @@ class File extends Node implements DAV\PartialUpdate\IPatchSupport {
*/
function put($data) {
- file_put_contents($this->path,$data);
+ file_put_contents($this->path, $data);
clearstatcache(true, $this->path);
return $this->getETag();
@@ -59,13 +59,13 @@ class File extends Node implements DAV\PartialUpdate\IPatchSupport {
*/
function patch($data, $rangeType, $offset = null) {
- switch($rangeType) {
+ switch ($rangeType) {
case 1 :
$f = fopen($this->path, 'a');
break;
case 2 :
$f = fopen($this->path, 'c');
- fseek($f,$offset);
+ fseek($f, $offset);
break;
case 3 :
$f = fopen($this->path, 'c');
@@ -75,7 +75,7 @@ class File extends Node implements DAV\PartialUpdate\IPatchSupport {
if (is_string($data)) {
fwrite($f, $data);
} else {
- stream_copy_to_stream($data,$f);
+ stream_copy_to_stream($data, $f);
}
fclose($f);
clearstatcache(true, $this->path);
@@ -90,7 +90,7 @@ class File extends Node implements DAV\PartialUpdate\IPatchSupport {
*/
function get() {
- return fopen($this->path,'r');
+ return fopen($this->path, 'r');
}
@@ -121,7 +121,7 @@ class File extends Node implements DAV\PartialUpdate\IPatchSupport {
fileinode($this->path) .
filesize($this->path) .
filemtime($this->path)
- ). '"';
+ ) . '"';
}
diff --git a/lib/DAV/File.php b/lib/DAV/File.php
index 2a2cd3e..6c36a4c 100644
--- a/lib/DAV/File.php
+++ b/lib/DAV/File.php
@@ -82,4 +82,3 @@ abstract class File extends Node implements IFile {
}
}
-
diff --git a/lib/DAV/ICollection.php b/lib/DAV/ICollection.php
index 7fa376b..2cf28db 100644
--- a/lib/DAV/ICollection.php
+++ b/lib/DAV/ICollection.php
@@ -74,4 +74,3 @@ interface ICollection extends INode {
function childExists($name);
}
-
diff --git a/lib/DAV/IExtendedCollection.php b/lib/DAV/IExtendedCollection.php
index f1688eb..4dc370b 100644
--- a/lib/DAV/IExtendedCollection.php
+++ b/lib/DAV/IExtendedCollection.php
@@ -41,4 +41,3 @@ interface IExtendedCollection extends ICollection {
function createExtendedCollection($name, MkCol $mkCol);
}
-
diff --git a/lib/DAV/IFile.php b/lib/DAV/IFile.php
index 4e6a3e5..c5859d1 100644
--- a/lib/DAV/IFile.php
+++ b/lib/DAV/IFile.php
@@ -79,4 +79,3 @@ interface IFile extends INode {
function getSize();
}
-
diff --git a/lib/DAV/INode.php b/lib/DAV/INode.php
index 624549e..8440745 100644
--- a/lib/DAV/INode.php
+++ b/lib/DAV/INode.php
@@ -43,4 +43,3 @@ interface INode {
function getLastModified();
}
-
diff --git a/lib/DAV/IProperties.php b/lib/DAV/IProperties.php
index a07ca97..9f07aed 100644
--- a/lib/DAV/IProperties.php
+++ b/lib/DAV/IProperties.php
@@ -45,4 +45,3 @@ interface IProperties extends INode {
function getProperties($properties);
}
-
diff --git a/lib/DAV/IQuota.php b/lib/DAV/IQuota.php
index 74b759c..f380de3 100644
--- a/lib/DAV/IQuota.php
+++ b/lib/DAV/IQuota.php
@@ -24,4 +24,3 @@ interface IQuota extends ICollection {
function getQuotaInfo();
}
-
diff --git a/lib/DAV/Locks/Backend/AbstractBackend.php b/lib/DAV/Locks/Backend/AbstractBackend.php
index ab383bb..32c343d 100644
--- a/lib/DAV/Locks/Backend/AbstractBackend.php
+++ b/lib/DAV/Locks/Backend/AbstractBackend.php
@@ -2,8 +2,6 @@
namespace Sabre\DAV\Locks\Backend;
-use Sabre\DAV\Locks;
-
/**
* This is an Abstract clas for lock backends.
*
@@ -18,4 +16,3 @@ use Sabre\DAV\Locks;
abstract class AbstractBackend implements BackendInterface {
}
-
diff --git a/lib/DAV/Locks/Backend/BackendInterface.php b/lib/DAV/Locks/Backend/BackendInterface.php
index 68e9c1e..38e3c94 100644
--- a/lib/DAV/Locks/Backend/BackendInterface.php
+++ b/lib/DAV/Locks/Backend/BackendInterface.php
@@ -36,7 +36,7 @@ interface BackendInterface {
* @param Locks\LockInfo $lockInfo
* @return bool
*/
- function lock($uri,Locks\LockInfo $lockInfo);
+ function lock($uri, Locks\LockInfo $lockInfo);
/**
* Removes a lock from a uri
@@ -45,7 +45,6 @@ interface BackendInterface {
* @param Locks\LockInfo $lockInfo
* @return bool
*/
- function unlock($uri,Locks\LockInfo $lockInfo);
+ function unlock($uri, Locks\LockInfo $lockInfo);
}
-
diff --git a/lib/DAV/Locks/Backend/File.php b/lib/DAV/Locks/Backend/File.php
index efdbddd..a9e1d1b 100644
--- a/lib/DAV/Locks/Backend/File.php
+++ b/lib/DAV/Locks/Backend/File.php
@@ -56,14 +56,14 @@ class File extends AbstractBackend {
$locks = $this->getData();
- foreach($locks as $lock) {
+ foreach ($locks as $lock) {
if ($lock->uri === $uri ||
//deep locks on parents
- ($lock->depth!=0 && strpos($uri, $lock->uri . '/')===0) ||
+ ($lock->depth != 0 && strpos($uri, $lock->uri . '/') === 0) ||
// locks on children
- ($returnChildLocks && (strpos($lock->uri, $uri . '/')===0)) ) {
+ ($returnChildLocks && (strpos($lock->uri, $uri . '/') === 0))) {
$newLocks[] = $lock;
@@ -72,7 +72,7 @@ class File extends AbstractBackend {
}
// Checking if we can remove any of these locks
- foreach($newLocks as $k=>$lock) {
+ foreach ($newLocks as $k => $lock) {
if (time() > $lock->timeout + $lock->created) unset($newLocks[$k]);
}
return $newLocks;
@@ -95,7 +95,7 @@ class File extends AbstractBackend {
$locks = $this->getData();
- foreach($locks as $k=>$lock) {
+ foreach ($locks as $k => $lock) {
if (
($lock->token == $lockInfo->token) ||
(time() > $lock->timeout + $lock->created)
@@ -119,7 +119,7 @@ class File extends AbstractBackend {
function unlock($uri, LockInfo $lockInfo) {
$locks = $this->getData();
- foreach($locks as $k=>$lock) {
+ foreach ($locks as $k => $lock) {
if ($lock->token == $lockInfo->token) {
@@ -143,14 +143,14 @@ class File extends AbstractBackend {
if (!file_exists($this->locksFile)) return [];
// opening up the file, and creating a shared lock
- $handle = fopen($this->locksFile,'r');
- flock($handle,LOCK_SH);
+ $handle = fopen($this->locksFile, 'r');
+ flock($handle, LOCK_SH);
// Reading data until the eof
$data = stream_get_contents($handle);
// We're all good
- flock($handle,LOCK_UN);
+ flock($handle, LOCK_UN);
fclose($handle);
// Unserializing and checking if the resource file contains data for this file
@@ -169,15 +169,15 @@ class File extends AbstractBackend {
protected function putData(array $newData) {
// opening up the file, and creating an exclusive lock
- $handle = fopen($this->locksFile,'a+');
- flock($handle,LOCK_EX);
+ $handle = fopen($this->locksFile, 'a+');
+ flock($handle, LOCK_EX);
// We can only truncate and rewind once the lock is acquired.
- ftruncate($handle,0);
+ ftruncate($handle, 0);
rewind($handle);
- fwrite($handle,serialize($newData));
- flock($handle,LOCK_UN);
+ fwrite($handle, serialize($newData));
+ flock($handle, LOCK_UN);
fclose($handle);
}
diff --git a/lib/DAV/Locks/Backend/PDO.php b/lib/DAV/Locks/Backend/PDO.php
index d7415b9..d39bb08 100644
--- a/lib/DAV/Locks/Backend/PDO.php
+++ b/lib/DAV/Locks/Backend/PDO.php
@@ -59,41 +59,41 @@ class PDO extends AbstractBackend {
// NOTE: the following 10 lines or so could be easily replaced by
// pure sql. MySQL's non-standard string concatenation prevents us
// from doing this though.
- $query = 'SELECT owner, token, timeout, created, scope, depth, uri FROM '.$this->tableName.' WHERE ((created + timeout) > CAST(? AS UNSIGNED INTEGER)) AND ((uri = ?)';
+ $query = 'SELECT owner, token, timeout, created, scope, depth, uri FROM ' . $this->tableName . ' WHERE ((created + timeout) > CAST(? AS UNSIGNED INTEGER)) AND ((uri = ?)';
$params = [time(),$uri];
// We need to check locks for every part in the uri.
- $uriParts = explode('/',$uri);
+ $uriParts = explode('/', $uri);
// We already covered the last part of the uri
array_pop($uriParts);
- $currentPath='';
+ $currentPath = '';
- foreach($uriParts as $part) {
+ foreach ($uriParts as $part) {
- if ($currentPath) $currentPath.='/';
- $currentPath.=$part;
+ if ($currentPath) $currentPath .= '/';
+ $currentPath .= $part;
- $query.=' OR (depth!=0 AND uri = ?)';
+ $query .= ' OR (depth!=0 AND uri = ?)';
$params[] = $currentPath;
}
if ($returnChildLocks) {
- $query.=' OR (uri LIKE ?)';
+ $query .= ' OR (uri LIKE ?)';
$params[] = $uri . '/%';
}
- $query.=')';
+ $query .= ')';
$stmt = $this->pdo->prepare($query);
$stmt->execute($params);
$result = $stmt->fetchAll();
$lockList = [];
- foreach($result as $row) {
+ foreach ($result as $row) {
$lockInfo = new LockInfo();
$lockInfo->owner = $row['owner'];
@@ -121,18 +121,18 @@ class PDO extends AbstractBackend {
function lock($uri, LockInfo $lockInfo) {
// We're making the lock timeout 30 minutes
- $lockInfo->timeout = 30*60;
+ $lockInfo->timeout = 30 * 60;
$lockInfo->created = time();
$lockInfo->uri = $uri;
- $locks = $this->getLocks($uri,false);
+ $locks = $this->getLocks($uri, false);
$exists = false;
- foreach($locks as $lock) {
+ foreach ($locks as $lock) {
if ($lock->token == $lockInfo->token) $exists = true;
}
if ($exists) {
- $stmt = $this->pdo->prepare('UPDATE '.$this->tableName.' SET owner = ?, timeout = ?, scope = ?, depth = ?, uri = ?, created = ? WHERE token = ?');
+ $stmt = $this->pdo->prepare('UPDATE ' . $this->tableName . ' SET owner = ?, timeout = ?, scope = ?, depth = ?, uri = ?, created = ? WHERE token = ?');
$stmt->execute([
$lockInfo->owner,
$lockInfo->timeout,
@@ -143,7 +143,7 @@ class PDO extends AbstractBackend {
$lockInfo->token
]);
} else {
- $stmt = $this->pdo->prepare('INSERT INTO '.$this->tableName.' (owner,timeout,scope,depth,uri,created,token) VALUES (?,?,?,?,?,?,?)');
+ $stmt = $this->pdo->prepare('INSERT INTO ' . $this->tableName . ' (owner,timeout,scope,depth,uri,created,token) VALUES (?,?,?,?,?,?,?)');
$stmt->execute([
$lockInfo->owner,
$lockInfo->timeout,
@@ -170,12 +170,11 @@ class PDO extends AbstractBackend {
*/
function unlock($uri, LockInfo $lockInfo) {
- $stmt = $this->pdo->prepare('DELETE FROM '.$this->tableName.' WHERE uri = ? AND token = ?');
+ $stmt = $this->pdo->prepare('DELETE FROM ' . $this->tableName . ' WHERE uri = ? AND token = ?');
$stmt->execute([$uri, $lockInfo->token]);
- return $stmt->rowCount()===1;
+ return $stmt->rowCount() === 1;
}
}
-
diff --git a/lib/DAV/Locks/LockInfo.php b/lib/DAV/Locks/LockInfo.php
index ed3c029..ad1db59 100644
--- a/lib/DAV/Locks/LockInfo.php
+++ b/lib/DAV/Locks/LockInfo.php
@@ -78,4 +78,3 @@ class LockInfo {
public $uri;
}
-
diff --git a/lib/DAV/Locks/Plugin.php b/lib/DAV/Locks/Plugin.php
index 4a194aa..6b92744 100644
--- a/lib/DAV/Locks/Plugin.php
+++ b/lib/DAV/Locks/Plugin.php
@@ -2,10 +2,9 @@
namespace Sabre\DAV\Locks;
-use
- Sabre\DAV,
- Sabre\HTTP\RequestInterface,
- Sabre\HTTP\ResponseInterface;
+use Sabre\DAV;
+use Sabre\HTTP\RequestInterface;
+use Sabre\HTTP\ResponseInterface;
/**
* Locking plugin
@@ -99,7 +98,7 @@ class Plugin extends DAV\ServerPlugin {
});
$propFind->handle('{DAV:}lockdiscovery', function() use ($propFind) {
return new DAV\Xml\Property\LockDiscovery(
- $this->getLocks( $propFind->getPath() )
+ $this->getLocks($propFind->getPath())
);
});
@@ -180,7 +179,7 @@ class Plugin extends DAV\ServerPlugin {
$existingLock = null;
// Checking if there's already non-shared locks on the uri.
- foreach($existingLocks as $existingLock) {
+ foreach ($existingLocks as $existingLock) {
if ($existingLock->scope === LockInfo::EXCLUSIVE) {
throw new DAV\Exception\ConflictingLock($existingLock);
}
@@ -189,7 +188,7 @@ class Plugin extends DAV\ServerPlugin {
$lockInfo = $this->parseLockRequest($body);
$lockInfo->depth = $this->server->getHTTPDepth();
$lockInfo->uri = $uri;
- if($existingLock && $lockInfo->scope != LockInfo::SHARED)
+ if ($existingLock && $lockInfo->scope != LockInfo::SHARED)
throw new DAV\Exception\ConflictingLock($existingLock);
} else {
@@ -199,9 +198,9 @@ class Plugin extends DAV\ServerPlugin {
$conditions = $this->server->getIfConditions($request);
$found = null;
- foreach($existingLocks as $existingLock) {
- foreach($conditions as $condition) {
- foreach($condition['tokens'] as $token) {
+ foreach ($existingLocks as $existingLock) {
+ foreach ($conditions as $condition) {
+ foreach ($condition['tokens'] as $token) {
if ($token['token'] === 'opaquelocktoken:' . $existingLock->token) {
$found = $existingLock;
break 3;
@@ -224,7 +223,7 @@ class Plugin extends DAV\ServerPlugin {
$lockInfo = $found;
// The resource could have been locked through another uri.
- if ($uri!=$lockInfo->uri) $uri = $lockInfo->uri;
+ if ($uri != $lockInfo->uri) $uri = $lockInfo->uri;
}
@@ -245,16 +244,16 @@ class Plugin extends DAV\ServerPlugin {
} catch (DAV\Exception\NotFound $e) {
// It didn't, lets create it
- $this->server->createFile($uri,fopen('php://memory','r'));
+ $this->server->createFile($uri, fopen('php://memory', 'r'));
$newFile = true;
}
- $this->lockNode($uri,$lockInfo);
+ $this->lockNode($uri, $lockInfo);
- $response->setHeader('Content-Type','application/xml; charset=utf-8');
- $response->setHeader('Lock-Token','<opaquelocktoken:' . $lockInfo->token . '>');
- $response->setStatus($newFile?201:200);
+ $response->setHeader('Content-Type', 'application/xml; charset=utf-8');
+ $response->setHeader('Lock-Token', '<opaquelocktoken:' . $lockInfo->token . '>');
+ $response->setStatus($newFile ? 201 : 200);
$response->setBody($this->generateLockResponse($lockInfo));
// Returning false will interupt the event chain and mark this method
@@ -285,14 +284,14 @@ class Plugin extends DAV\ServerPlugin {
// Windows sometimes forgets to include < and > in the Lock-Token
// header
- if ($lockToken[0]!=='<') $lockToken = '<' . $lockToken . '>';
+ if ($lockToken[0] !== '<') $lockToken = '<' . $lockToken . '>';
- foreach($locks as $lock) {
+ foreach ($locks as $lock) {
if ('<opaquelocktoken:' . $lock->token . '>' == $lockToken) {
- $this->unlockNode($path,$lock);
- $response->setHeader('Content-Length','0');
+ $this->unlockNode($path, $lock);
+ $response->setHeader('Content-Length', '0');
$response->setStatus(204);
// Returning false will break the method chain, and mark the
@@ -319,7 +318,7 @@ class Plugin extends DAV\ServerPlugin {
function afterUnbind($path) {
$locks = $this->getLocks($path, $includeChildren = true);
- foreach($locks as $lock) {
+ foreach ($locks as $lock) {
$this->unlockNode($path, $lock);
}
@@ -335,10 +334,10 @@ class Plugin extends DAV\ServerPlugin {
* @param LockInfo $lockInfo
* @return bool
*/
- function lockNode($uri,LockInfo $lockInfo) {
+ function lockNode($uri, LockInfo $lockInfo) {
- if (!$this->server->emit('beforeLock', [$uri,$lockInfo])) return;
- return $this->locksBackend->lock($uri,$lockInfo);
+ if (!$this->server->emit('beforeLock', [$uri, $lockInfo])) return;
+ return $this->locksBackend->lock($uri, $lockInfo);
}
@@ -353,8 +352,8 @@ class Plugin extends DAV\ServerPlugin {
*/
function unlockNode($uri, LockInfo $lockInfo) {
- if (!$this->server->emit('beforeUnlock', [$uri,$lockInfo])) return;
- return $this->locksBackend->unlock($uri,$lockInfo);
+ if (!$this->server->emit('beforeUnlock', [$uri, $lockInfo])) return;
+ return $this->locksBackend->unlock($uri, $lockInfo);
}
@@ -372,8 +371,8 @@ class Plugin extends DAV\ServerPlugin {
if ($header) {
- if (stripos($header,'second-')===0) $header = (int)(substr($header,7));
- else if (stripos($header,'infinite')===0) $header = LockInfo::TIMEOUT_INFINITE;
+ if (stripos($header, 'second-') === 0) $header = (int)(substr($header, 7));
+ elseif (stripos($header, 'infinite') === 0) $header = LockInfo::TIMEOUT_INFINITE;
else throw new DAV\Exception\BadRequest('Invalid HTTP timeout header');
} else {
@@ -394,7 +393,7 @@ class Plugin extends DAV\ServerPlugin {
*/
protected function generateLockResponse(LockInfo $lockInfo) {
- return $this->server->xml->write('{DAV:}prop',[
+ return $this->server->xml->write('{DAV:}prop', [
'{DAV:}lockdiscovery' =>
new DAV\Xml\Property\LockDiscovery([$lockInfo])
]);
@@ -413,7 +412,7 @@ class Plugin extends DAV\ServerPlugin {
* @param mixed $conditions
* @return void
*/
- function validateTokens( RequestInterface $request, &$conditions ) {
+ function validateTokens(RequestInterface $request, &$conditions) {
// First we need to gather a list of locks that must be satisfied.
$mustLocks = [];
@@ -421,7 +420,7 @@ class Plugin extends DAV\ServerPlugin {
// Methods not in that list are operations that doesn't alter any
// resources, and we don't need to check the lock-states for.
- switch($method) {
+ switch ($method) {
case 'DELETE' :
$mustLocks = array_merge($mustLocks, $this->getLocks(
@@ -458,8 +457,8 @@ class Plugin extends DAV\ServerPlugin {
case 'LOCK' :
//Temporary measure.. figure out later why this is needed
// Here we basically ignore all incoming tokens...
- foreach($conditions as $ii=>$condition) {
- foreach($condition['tokens'] as $jj=>$token) {
+ foreach ($conditions as $ii => $condition) {
+ foreach ($condition['tokens'] as $jj => $token) {
$conditions[$ii]['tokens'][$jj]['validToken'] = true;
}
}
@@ -470,21 +469,21 @@ class Plugin extends DAV\ServerPlugin {
// It's possible that there's identical locks, because of shared
// parents. We're removing the duplicates here.
$tmp = [];
- foreach($mustLocks as $lock) $tmp[$lock->token] = $lock;
+ foreach ($mustLocks as $lock) $tmp[$lock->token] = $lock;
$mustLocks = array_values($tmp);
- foreach($conditions as $kk=>$condition) {
+ foreach ($conditions as $kk => $condition) {
- foreach($condition['tokens'] as $ii=>$token) {
+ foreach ($condition['tokens'] as $ii => $token) {
// Lock tokens always start with opaquelocktoken:
if (substr($token['token'], 0, 16) !== 'opaquelocktoken:') {
continue;
}
- $checkToken = substr($token['token'],16);
+ $checkToken = substr($token['token'], 16);
// Looping through our list with locks.
- foreach($mustLocks as $jj => $mustLock) {
+ foreach ($mustLocks as $jj => $mustLock) {
if ($mustLock->token == $checkToken) {
@@ -513,7 +512,7 @@ class Plugin extends DAV\ServerPlugin {
// This also gets triggered when the user specified a
// lock-token that was expired.
$oddLocks = $this->getLocks($condition['uri']);
- foreach($oddLocks as $oddLock) {
+ foreach ($oddLocks as $oddLock) {
if ($oddLock->token === $checkToken) {
diff --git a/lib/DAV/MkCol.php b/lib/DAV/MkCol.php
index 5547e2a..1dd4303 100644
--- a/lib/DAV/MkCol.php
+++ b/lib/DAV/MkCol.php
@@ -24,15 +24,15 @@ class MkCol extends PropPatch {
/**
* A list of resource-types in clark-notation.
- *
- * @var array
+ *
+ * @var array
*/
protected $resourceType;
/**
* Creates the MKCOL object.
- *
- * @param string[] $resourceType List of resourcetype values.
+ *
+ * @param string[] $resourceType List of resourcetype values.
* @param array $mutations List of new properties values.
*/
function __construct(array $resourceType, array $mutations) {
diff --git a/lib/DAV/Mount/Plugin.php b/lib/DAV/Mount/Plugin.php
index c4c1310..cbd58f5 100644
--- a/lib/DAV/Mount/Plugin.php
+++ b/lib/DAV/Mount/Plugin.php
@@ -2,10 +2,9 @@
namespace Sabre\DAV\Mount;
-use
- Sabre\DAV,
- Sabre\HTTP\RequestInterface,
- Sabre\HTTP\ResponseInterface;
+use Sabre\DAV;
+use Sabre\HTTP\RequestInterface;
+use Sabre\HTTP\ResponseInterface;
/**
* This plugin provides support for RFC4709: Mounting WebDAV servers
@@ -34,7 +33,7 @@ class Plugin extends DAV\ServerPlugin {
function initialize(DAV\Server $server) {
$this->server = $server;
- $this->server->on('method:GET', [$this,'httpGet'], 90);
+ $this->server->on('method:GET', [$this, 'httpGet'], 90);
}
@@ -54,7 +53,7 @@ class Plugin extends DAV\ServerPlugin {
$currentUri = $request->getAbsoluteUrl();
// Stripping off everything after the ?
- list($currentUri) = explode('?',$currentUri);
+ list($currentUri) = explode('?', $currentUri);
$this->davMount($response, $currentUri);
@@ -72,7 +71,7 @@ class Plugin extends DAV\ServerPlugin {
function davMount(ResponseInterface $response, $uri) {
$response->setStatus(200);
- $response->setHeader('Content-Type','application/davmount+xml');
+ $response->setHeader('Content-Type', 'application/davmount+xml');
ob_start();
echo '<?xml version="1.0"?>', "\n";
echo "<dm:mount xmlns:dm=\"http://purl.org/NET/webdav/mount\">\n";
diff --git a/lib/DAV/Node.php b/lib/DAV/Node.php
index 97ef76e..cc46f43 100644
--- a/lib/DAV/Node.php
+++ b/lib/DAV/Node.php
@@ -52,4 +52,3 @@ abstract class Node implements INode {
}
}
-
diff --git a/lib/DAV/PartialUpdate/IPatchSupport.php b/lib/DAV/PartialUpdate/IPatchSupport.php
index 81ada25..8aa948a 100644
--- a/lib/DAV/PartialUpdate/IPatchSupport.php
+++ b/lib/DAV/PartialUpdate/IPatchSupport.php
@@ -45,4 +45,3 @@ interface IPatchSupport extends DAV\IFile {
function patch($data, $rangeType, $offset = null);
}
-
diff --git a/lib/DAV/PartialUpdate/Plugin.php b/lib/DAV/PartialUpdate/Plugin.php
index 576d88e..c8496a3 100644
--- a/lib/DAV/PartialUpdate/Plugin.php
+++ b/lib/DAV/PartialUpdate/Plugin.php
@@ -2,10 +2,9 @@
namespace Sabre\DAV\PartialUpdate;
-use
- Sabre\DAV,
- Sabre\HTTP\RequestInterface,
- Sabre\HTTP\ResponseInterface;
+use Sabre\DAV;
+use Sabre\HTTP\RequestInterface;
+use Sabre\HTTP\ResponseInterface;
/**
* Partial update plugin (Patch method)
@@ -45,7 +44,7 @@ class Plugin extends DAV\ServerPlugin {
function initialize(DAV\Server $server) {
$this->server = $server;
- $server->on('method:PATCH', [$this,'httpPatch']);
+ $server->on('method:PATCH', [$this, 'httpPatch']);
}
@@ -140,7 +139,7 @@ class Plugin extends DAV\ServerPlugin {
$len = $this->server->httpRequest->getHeader('Content-Length');
if (!$len) throw new DAV\Exception\LengthRequired('A Content-Length header is required');
- switch($range[0]) {
+ switch ($range[0]) {
case self::RANGE_START :
// Calculate the end-range if it doesn't exist.
if (!$range[2]) {
@@ -149,7 +148,7 @@ class Plugin extends DAV\ServerPlugin {
if ($range[2] < $range[1]) {
throw new DAV\Exception\RequestedRangeNotSatisfiable('The end offset (' . $range[2] . ') is lower than the start offset (' . $range[1] . ')');
}
- if($range[2] - $range[1] + 1 != $len) {
+ if ($range[2] - $range[1] + 1 != $len) {
throw new DAV\Exception\RequestedRangeNotSatisfiable('Actual data length (' . $len . ') is not consistent with begin (' . $range[1] . ') and end (' . $range[2] . ') offsets');
}
}
@@ -162,12 +161,12 @@ class Plugin extends DAV\ServerPlugin {
$body = $this->server->httpRequest->getBody();
- $etag = $node->patch($body, $range[0], isset($range[1])?$range[1]:null);
+ $etag = $node->patch($body, $range[0], isset($range[1]) ? $range[1] : null);
$this->server->emit('afterWriteContent', [$path, $node]);
- $response->setHeader('Content-Length','0');
- if ($etag) $response->setHeader('ETag',$etag);
+ $response->setHeader('Content-Length', '0');
+ if ($etag) $response->setHeader('ETag', $etag);
$response->setStatus(204);
// Breaks the event chain
@@ -202,12 +201,12 @@ class Plugin extends DAV\ServerPlugin {
// Matching "Range: bytes=1234-5678: both numbers are optional
- if (!preg_match('/^(append)|(?:bytes=([0-9]+)-([0-9]*))|(?:bytes=(-[0-9]+))$/i',$range,$matches)) return null;
+ if (!preg_match('/^(append)|(?:bytes=([0-9]+)-([0-9]*))|(?:bytes=(-[0-9]+))$/i', $range, $matches)) return null;
- if ($matches[1]==='append') {
+ if ($matches[1] === 'append') {
return [self::RANGE_APPEND];
- } elseif (strlen($matches[2])>0) {
- return [self::RANGE_START, $matches[2], $matches[3]?:null];
+ } elseif (strlen($matches[2]) > 0) {
+ return [self::RANGE_START, $matches[2], $matches[3] ?: null];
} else {
return [self::RANGE_END, $matches[4]];
}
diff --git a/lib/DAV/PropFind.php b/lib/DAV/PropFind.php
index e52d1c1..8ae6b6c 100644
--- a/lib/DAV/PropFind.php
+++ b/lib/DAV/PropFind.php
@@ -47,7 +47,7 @@ class PropFind {
$this->depth = $depth;
$this->requestType = $requestType;
- if($requestType === self::ALLPROPS) {
+ if ($requestType === self::ALLPROPS) {
$this->properties = [
'{DAV:}getlastmodified',
'{DAV:}getcontentlength',
@@ -59,7 +59,7 @@ class PropFind {
];
}
- foreach($this->properties as $propertyName) {
+ foreach ($this->properties as $propertyName) {
// Seeding properties with 404's.
$this->result[$propertyName] = [404, null];
@@ -131,7 +131,7 @@ class PropFind {
}
return;
}
- if ($status!==404 && $this->result[$propertyName][0]===404) {
+ if ($status !== 404 && $this->result[$propertyName][0] === 404) {
$this->itemsLeft--;
} elseif ($status === 404 && $this->result[$propertyName][0] !== 404) {
$this->itemsLeft++;
@@ -148,7 +148,7 @@ class PropFind {
*/
function get($propertyName) {
- return isset($this->result[$propertyName])?$this->result[$propertyName][1]:null;
+ return isset($this->result[$propertyName]) ? $this->result[$propertyName][1] : null;
}
@@ -163,7 +163,7 @@ class PropFind {
*/
function getStatus($propertyName) {
- return isset($this->result[$propertyName])?$this->result[$propertyName][0]:null;
+ return isset($this->result[$propertyName]) ? $this->result[$propertyName][0] : null;
}
@@ -225,8 +225,8 @@ class PropFind {
return [];
}
$result = [];
- foreach($this->result as $propertyName=>$stuff) {
- if ($stuff[0]===404) {
+ foreach ($this->result as $propertyName => $stuff) {
+ if ($stuff[0] === 404) {
$result[] = $propertyName;
}
}
@@ -276,7 +276,7 @@ class PropFind {
200 => [],
404 => [],
];
- foreach($this->result as $propertyName=>$info) {
+ foreach ($this->result as $propertyName => $info) {
if (!isset($r[$info[0]])) {
$r[$info[0]] = [$propertyName => $info[1]];
} else {
diff --git a/lib/DAV/PropPatch.php b/lib/DAV/PropPatch.php
index d14f8e4..f8f0bdf 100644
--- a/lib/DAV/PropPatch.php
+++ b/lib/DAV/PropPatch.php
@@ -80,7 +80,7 @@ class PropPatch {
function handle($properties, callable $callback) {
$usedProperties = [];
- foreach((array)$properties as $propertyName) {
+ foreach ((array)$properties as $propertyName) {
if (array_key_exists($propertyName, $this->mutations) && !isset($this->result[$propertyName])) {
@@ -99,7 +99,7 @@ class PropPatch {
// If the original argument to this method was a string, we need
// to also make sure that it stays that way, so the commit function
// knows how to format the arguments to the callback.
- is_string($properties)?$properties:$usedProperties,
+ is_string($properties) ? $properties : $usedProperties,
$callback
];
@@ -121,7 +121,7 @@ class PropPatch {
return;
}
- foreach($properties as $propertyName) {
+ foreach ($properties as $propertyName) {
// HTTP Accepted
$this->result[$propertyName] = 202;
@@ -142,11 +142,11 @@ class PropPatch {
*/
function setResultCode($properties, $resultCode) {
- foreach((array)$properties as $propertyName) {
+ foreach ((array)$properties as $propertyName) {
$this->result[$propertyName] = $resultCode;
}
- if ($resultCode>=400) {
+ if ($resultCode >= 400) {
$this->failed = true;
}
@@ -177,7 +177,7 @@ class PropPatch {
function getRemainingMutations() {
$remaining = [];
- foreach($this->mutations as $propertyName => $propValue) {
+ foreach ($this->mutations as $propertyName => $propValue) {
if (!isset($this->result[$propertyName])) {
$remaining[] = $propertyName;
}
@@ -197,7 +197,7 @@ class PropPatch {
function getRemainingValues() {
$remaining = [];
- foreach($this->mutations as $propertyName => $propValue) {
+ foreach ($this->mutations as $propertyName => $propValue) {
if (!isset($this->result[$propertyName])) {
$remaining[$propertyName] = $propValue;
}
@@ -218,7 +218,7 @@ class PropPatch {
function commit() {
// First we validate if every property has a handler
- foreach($this->mutations as $propertyName => $value) {
+ foreach ($this->mutations as $propertyName => $value) {
if (!isset($this->result[$propertyName])) {
$this->failed = true;
@@ -227,7 +227,7 @@ class PropPatch {
}
- foreach($this->propertyUpdateCallbacks as $callbackInfo) {
+ foreach ($this->propertyUpdateCallbacks as $callbackInfo) {
if ($this->failed) {
break;
@@ -246,7 +246,7 @@ class PropPatch {
*/
if ($this->failed) {
- foreach($this->result as $propertyName=>$status) {
+ foreach ($this->result as $propertyName => $status) {
if ($status === 202) {
// Failed dependency
$this->result[$propertyName] = 424;
@@ -287,7 +287,7 @@ class PropPatch {
throw new UnexpectedValueException('A callback sent to handle() did not return an int or a bool');
}
$this->result[$propertyName] = $result;
- if ($result>=400) {
+ if ($result >= 400) {
$this->failed = true;
}
@@ -303,14 +303,14 @@ class PropPatch {
private function doCallBackMultiProp(array $propertyList, callable $callback) {
$argument = [];
- foreach($propertyList as $propertyName) {
+ foreach ($propertyList as $propertyName) {
$argument[$propertyName] = $this->mutations[$propertyName];
}
$result = $callback($argument);
if (is_array($result)) {
- foreach($propertyList as $propertyName) {
+ foreach ($propertyList as $propertyName) {
if (!isset($result[$propertyName])) {
$resultCode = 500;
} else {
@@ -325,14 +325,14 @@ class PropPatch {
} elseif ($result === true) {
// Success
- foreach($argument as $propertyName=>$propertyValue) {
- $this->result[$propertyName] = is_null($propertyValue)?204:200;
+ foreach ($argument as $propertyName => $propertyValue) {
+ $this->result[$propertyName] = is_null($propertyValue) ? 204 : 200;
}
} elseif ($result === false) {
// Fail :(
$this->failed = true;
- foreach($propertyList as $propertyName) {
+ foreach ($propertyList as $propertyName) {
$this->result[$propertyName] = 403;
}
} else {
diff --git a/lib/DAV/PropertyStorage/Backend/PDO.php b/lib/DAV/PropertyStorage/Backend/PDO.php
index 4b16ece..25c2892 100644
--- a/lib/DAV/PropertyStorage/Backend/PDO.php
+++ b/lib/DAV/PropertyStorage/Backend/PDO.php
@@ -4,7 +4,6 @@ namespace Sabre\DAV\PropertyStorage\Backend;
use Sabre\DAV\PropFind;
use Sabre\DAV\PropPatch;
-
use Sabre\DAV\Xml\Property\Complex;
/**
@@ -81,8 +80,8 @@ class PDO implements BackendInterface {
$stmt = $this->pdo->prepare($query);
$stmt->execute([$path]);
- while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
- switch($row['valuetype']) {
+ while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
+ switch ($row['valuetype']) {
case null :
case self::VT_STRING :
$propFind->set($row['name'], $row['value']);
@@ -118,7 +117,7 @@ class PDO implements BackendInterface {
$updateStmt = $this->pdo->prepare("REPLACE INTO propertystorage (path, name, valuetype, value) VALUES (?, ?, ?, ?)");
$deleteStmt = $this->pdo->prepare("DELETE FROM propertystorage WHERE path = ? AND name = ?");
- foreach($properties as $name=>$value) {
+ foreach ($properties as $name => $value) {
if (!is_null($value)) {
if (is_scalar($value)) {
@@ -191,16 +190,16 @@ class PDO implements BackendInterface {
$select->execute([$source, $source . '/%']);
$update = $this->pdo->prepare('UPDATE propertystorage SET path = ? WHERE id = ?');
- while($row = $select->fetch(\PDO::FETCH_ASSOC)) {
+ while ($row = $select->fetch(\PDO::FETCH_ASSOC)) {
// Sanity check. SQL may select too many records, such as records
// with different cases.
- if ($row['path'] !== $source && strpos($row['path'], $source . '/')!==0) continue;
+ if ($row['path'] !== $source && strpos($row['path'], $source . '/') !== 0) continue;
- $trailingPart = substr($row['path'], strlen($source)+1);
+ $trailingPart = substr($row['path'], strlen($source) + 1);
$newPath = $destination;
if ($trailingPart) {
- $newPath.='/' . $trailingPart;
+ $newPath .= '/' . $trailingPart;
}
$update->execute([$newPath, $row['id']]);
diff --git a/lib/DAV/Server.php b/lib/DAV/Server.php
index 34b884c..ea88719 100644
--- a/lib/DAV/Server.php
+++ b/lib/DAV/Server.php
@@ -2,13 +2,12 @@
namespace Sabre\DAV;
-use
- Sabre\Event\EventEmitter,
- Sabre\HTTP,
- Sabre\HTTP\RequestInterface,
- Sabre\HTTP\ResponseInterface,
- Sabre\HTTP\URLUtil,
- Sabre\Uri;
+use Sabre\Event\EventEmitter;
+use Sabre\HTTP;
+use Sabre\HTTP\RequestInterface;
+use Sabre\HTTP\ResponseInterface;
+use Sabre\HTTP\URLUtil;
+use Sabre\Uri;
/**
* Main DAV server class
@@ -176,7 +175,7 @@ class Server extends EventEmitter {
*
* @var bool
*/
- static public $exposeVersion = true;
+ static $exposeVersion = true;
/**
* Sets up the server
@@ -203,7 +202,7 @@ class Server extends EventEmitter {
// If it's an array, a list of nodes was passed, and we need to
// create the root node.
- foreach($treeOrNode as $node) {
+ foreach ($treeOrNode as $node) {
if (!($node instanceof INode)) {
throw new Exception('Invalid argument passed to constructor. If you\'re passing an array, all the values must implement Sabre\\DAV\\INode');
}
@@ -254,11 +253,11 @@ class Server extends EventEmitter {
$this->emit('exception', [$e]);
} catch (\Exception $ignore) {
}
- $DOM = new \DOMDocument('1.0','utf-8');
+ $DOM = new \DOMDocument('1.0', 'utf-8');
$DOM->formatOutput = true;
- $error = $DOM->createElementNS('DAV:','d:error');
- $error->setAttribute('xmlns:s',self::NS_SABREDAV);
+ $error = $DOM->createElementNS('DAV:', 'd:error');
+ $error->setAttribute('xmlns:s', self::NS_SABREDAV);
$DOM->appendChild($error);
$h = function($v) {
@@ -268,37 +267,37 @@ class Server extends EventEmitter {
};
if (self::$exposeVersion) {
- $error->appendChild($DOM->createElement('s:sabredav-version',$h(Version::VERSION)));
+ $error->appendChild($DOM->createElement('s:sabredav-version', $h(Version::VERSION)));
}
- $error->appendChild($DOM->createElement('s:exception',$h(get_class($e))));
- $error->appendChild($DOM->createElement('s:message',$h($e->getMessage())));
+ $error->appendChild($DOM->createElement('s:exception', $h(get_class($e))));
+ $error->appendChild($DOM->createElement('s:message', $h($e->getMessage())));
if ($this->debugExceptions) {
- $error->appendChild($DOM->createElement('s:file',$h($e->getFile())));
- $error->appendChild($DOM->createElement('s:line',$h($e->getLine())));
- $error->appendChild($DOM->createElement('s:code',$h($e->getCode())));
- $error->appendChild($DOM->createElement('s:stacktrace',$h($e->getTraceAsString())));
+ $error->appendChild($DOM->createElement('s:file', $h($e->getFile())));
+ $error->appendChild($DOM->createElement('s:line', $h($e->getLine())));
+ $error->appendChild($DOM->createElement('s:code', $h($e->getCode())));
+ $error->appendChild($DOM->createElement('s:stacktrace', $h($e->getTraceAsString())));
}
if ($this->debugExceptions) {
$previous = $e;
while ($previous = $previous->getPrevious()) {
$xPrevious = $DOM->createElement('s:previous-exception');
- $xPrevious->appendChild($DOM->createElement('s:exception',$h(get_class($previous))));
- $xPrevious->appendChild($DOM->createElement('s:message',$h($previous->getMessage())));
- $xPrevious->appendChild($DOM->createElement('s:file',$h($previous->getFile())));
- $xPrevious->appendChild($DOM->createElement('s:line',$h($previous->getLine())));
- $xPrevious->appendChild($DOM->createElement('s:code',$h($previous->getCode())));
- $xPrevious->appendChild($DOM->createElement('s:stacktrace',$h($previous->getTraceAsString())));
+ $xPrevious->appendChild($DOM->createElement('s:exception', $h(get_class($previous))));
+ $xPrevious->appendChild($DOM->createElement('s:message', $h($previous->getMessage())));
+ $xPrevious->appendChild($DOM->createElement('s:file', $h($previous->getFile())));
+ $xPrevious->appendChild($DOM->createElement('s:line', $h($previous->getLine())));
+ $xPrevious->appendChild($DOM->createElement('s:code', $h($previous->getCode())));
+ $xPrevious->appendChild($DOM->createElement('s:stacktrace', $h($previous->getTraceAsString())));
$error->appendChild($xPrevious);
}
}
- if($e instanceof Exception) {
+ if ($e instanceof Exception) {
$httpCode = $e->getHTTPCode();
- $e->serialize($this,$error);
+ $e->serialize($this, $error);
$headers = $e->getHTTPHeaders($this);
} else {
@@ -327,8 +326,8 @@ class Server extends EventEmitter {
function setBaseUri($uri) {
// If the baseUri does not end with a slash, we must add it
- if ($uri[strlen($uri)-1]!=='/')
- $uri.='/';
+ if ($uri[strlen($uri) - 1] !== '/')
+ $uri .= '/';
$this->baseUri = $uri;
@@ -363,8 +362,8 @@ class Server extends EventEmitter {
if (!empty($pathInfo)) {
// We need to make sure we ignore the QUERY_STRING part
- if ($pos = strpos($uri,'?'))
- $uri = substr($uri,0,$pos);
+ if ($pos = strpos($uri, '?'))
+ $uri = substr($uri, 0, $pos);
// PATH_INFO is only set for urls, such as: /example.php/path
// in that case PATH_INFO contains '/path'.
@@ -374,12 +373,12 @@ class Server extends EventEmitter {
$decodedUri = URLUtil::decodePath($uri);
// A simple sanity check:
- if(substr($decodedUri,strlen($decodedUri)-strlen($pathInfo))===$pathInfo) {
- $baseUri = substr($decodedUri,0,strlen($decodedUri)-strlen($pathInfo));
- return rtrim($baseUri,'/') . '/';
+ if (substr($decodedUri, strlen($decodedUri) - strlen($pathInfo)) === $pathInfo) {
+ $baseUri = substr($decodedUri, 0, strlen($decodedUri) - strlen($pathInfo));
+ return rtrim($baseUri, '/') . '/';
}
- throw new Exception('The REQUEST_URI ('. $uri . ') did not end with the contents of PATH_INFO (' . $pathInfo . '). This server might be misconfigured.');
+ throw new Exception('The REQUEST_URI (' . $uri . ') did not end with the contents of PATH_INFO (' . $pathInfo . '). This server might be misconfigured.');
}
@@ -446,7 +445,7 @@ class Server extends EventEmitter {
if (!$this->emit('beforeMethod:' . $method, [$request, $response])) return;
if (!$this->emit('beforeMethod', [$request, $response])) return;
- if (Server::$exposeVersion) {
+ if (self::$exposeVersion) {
$response->setHeader('X-Sabre-Version', Version::VERSION);
}
@@ -505,7 +504,7 @@ class Server extends EventEmitter {
}
// We're also checking if any of the plugins register any new methods
- foreach($this->plugins as $plugin) $methods = array_merge($methods, $plugin->getHTTPMethods($path));
+ foreach ($this->plugins as $plugin) $methods = array_merge($methods, $plugin->getHTTPMethods($path));
array_unique($methods);
return $methods;
@@ -532,22 +531,22 @@ class Server extends EventEmitter {
*/
function calculateUri($uri) {
- if ($uri[0]!='/' && strpos($uri,'://')) {
+ if ($uri[0] != '/' && strpos($uri, '://')) {
- $uri = parse_url($uri,PHP_URL_PATH);
+ $uri = parse_url($uri, PHP_URL_PATH);
}
- $uri = Uri\normalize(str_replace('//','/',$uri));
+ $uri = Uri\normalize(str_replace('//', '/', $uri));
$baseUri = Uri\normalize($this->getBaseUri());
- if (strpos($uri,$baseUri)===0) {
+ if (strpos($uri, $baseUri) === 0) {
- return trim(URLUtil::decodePath(substr($uri,strlen($baseUri))),'/');
+ return trim(URLUtil::decodePath(substr($uri, strlen($baseUri))), '/');
// A special case, if the baseUri was accessed without a trailing
// slash, we'll accept it as well.
- } elseif ($uri.'/' === $baseUri) {
+ } elseif ($uri . '/' === $baseUri) {
return '';
@@ -606,13 +605,13 @@ class Server extends EventEmitter {
// Matching "Range: bytes=1234-5678: both numbers are optional
- if (!preg_match('/^bytes=([0-9]*)-([0-9]*)$/i',$range,$matches)) return null;
+ if (!preg_match('/^bytes=([0-9]*)-([0-9]*)$/i', $range, $matches)) return null;
- if ($matches[1]==='' && $matches[2]==='') return null;
+ if ($matches[1] === '' && $matches[2] === '') return null;
return [
- $matches[1]!==''?$matches[1]:null,
- $matches[2]!==''?$matches[2]:null,
+ $matches[1] !== '' ? $matches[1] : null,
+ $matches[2] !== '' ? $matches[2] : null,
];
}
@@ -660,16 +659,16 @@ class Server extends EventEmitter {
explode(',', $prefer)
);
- foreach($parameters as $parameter) {
+ foreach ($parameters as $parameter) {
// Right now our regex only supports the tokens actually
// specified in the draft. We may need to expand this if new
// tokens get registered.
- if(!preg_match('/^(?P<token>[a-z0-9-]+)(?:=(?P<value>[0-9]+))?$/', $parameter, $matches)) {
+ if (!preg_match('/^(?P<token>[a-z0-9-]+)(?:=(?P<value>[0-9]+))?$/', $parameter, $matches)) {
continue;
}
- switch($matches['token']) {
+ switch ($matches['token']) {
case 'return-asynch' :
case 'return-minimal' :
@@ -686,7 +685,7 @@ class Server extends EventEmitter {
}
- } elseif ($this->httpRequest->getHeader('Brief')=='t') {
+ } elseif ($this->httpRequest->getHeader('Brief') == 't') {
$result['return-minimal'] = true;
}
@@ -724,8 +723,8 @@ class Server extends EventEmitter {
$destination = $this->calculateUri($request->getHeader('Destination'));
$overwrite = $request->getHeader('Overwrite');
if (!$overwrite) $overwrite = 'T';
- if (strtoupper($overwrite)=='T') $overwrite = true;
- elseif (strtoupper($overwrite)=='F') $overwrite = false;
+ if (strtoupper($overwrite) == 'T') $overwrite = true;
+ elseif (strtoupper($overwrite) == 'F') $overwrite = false;
// We need to throw a bad request exception, if the header was invalid
else throw new Exception\BadRequest('The HTTP Overwrite header should be either T or F');
@@ -746,7 +745,7 @@ class Server extends EventEmitter {
// If this succeeded, it means the destination already exists
// we'll need to throw precondition failed in case overwrite is false
- if (!$overwrite) throw new Exception\PreconditionFailed('The destination node already exists, and the overwrite header is set to false','Overwrite');
+ if (!$overwrite) throw new Exception\PreconditionFailed('The destination node already exists, and the overwrite header is set to false', 'Overwrite');
} catch (Exception\NotFound $e) {
@@ -756,10 +755,10 @@ class Server extends EventEmitter {
}
$requestPath = $request->getPath();
- if ($destination===$requestPath) {
+ if ($destination === $requestPath) {
throw new Exception\Forbidden('Source and destination uri are identical.');
}
- if (substr($destination, 0, strlen($requestPath)+1) === $requestPath . '/') {
+ if (substr($destination, 0, strlen($requestPath) + 1) === $requestPath . '/') {
throw new Exception\Conflict('The destination may not be part of the same subtree as the source path.');
}
@@ -784,7 +783,7 @@ class Server extends EventEmitter {
*/
function getProperties($path, $propertyNames) {
- $result = $this->getPropertiesForPath($path,$propertyNames,0);
+ $result = $this->getPropertiesForPath($path, $propertyNames, 0);
return $result[0][200];
}
@@ -804,7 +803,7 @@ class Server extends EventEmitter {
function getPropertiesForChildren($path, $propertyNames) {
$result = [];
- foreach($this->getPropertiesForPath($path,$propertyNames,1) as $k=>$row) {
+ foreach ($this->getPropertiesForPath($path, $propertyNames, 1) as $k => $row) {
// Skipping the parent path
if ($k === 0) continue;
@@ -837,10 +836,10 @@ class Server extends EventEmitter {
'{DAV:}getetag' => 'ETag',
];
- $properties = $this->getProperties($path,array_keys($propertyMap));
+ $properties = $this->getProperties($path, array_keys($propertyMap));
$headers = [];
- foreach($propertyMap as $property=>$header) {
+ foreach ($propertyMap as $property => $header) {
if (!isset($properties[$property])) continue;
if (is_scalar($properties[$property])) {
@@ -869,10 +868,10 @@ class Server extends EventEmitter {
$newDepth--;
}
- foreach($this->tree->getChildren($path) as $childNode) {
+ foreach ($this->tree->getChildren($path) as $childNode) {
$subPropFind = clone $propFind;
$subPropFind->setDepth($newDepth);
- $subPath = $path? $path . '/' . $childNode->getName() : $childNode->getName();
+ $subPath = $path ? $path . '/' . $childNode->getName() : $childNode->getName();
$subPropFind->setPath($subPath);
$propFindRequests[] = [
@@ -880,7 +879,7 @@ class Server extends EventEmitter {
$childNode
];
- if (($newDepth===self::DEPTH_INFINITY || $newDepth>=1) && $childNode instanceof ICollection) {
+ if (($newDepth === self::DEPTH_INFINITY || $newDepth >= 1) && $childNode instanceof ICollection) {
$this->addPathNodesRecursively($propFindRequests, $subPropFind);
}
@@ -906,9 +905,9 @@ class Server extends EventEmitter {
// The only two options for the depth of a propfind is 0 or 1 - as long as depth infinity is not enabled
if (!$this->enablePropfindDepthInfinity && $depth != 0) $depth = 1;
- $path = trim($path,'/');
+ $path = trim($path, '/');
- $propFindType = $propertyNames?PropFind::NORMAL:PropFind::ALLPROPS;
+ $propFindType = $propertyNames ? PropFind::NORMAL : PropFind::ALLPROPS;
$propFind = new PropFind($path, (array)$propertyNames, $depth, $propFindType);
$parentNode = $this->tree->getNodeForPath($path);
@@ -924,7 +923,7 @@ class Server extends EventEmitter {
$returnPropertyList = [];
- foreach($propFindRequests as $propFindRequest) {
+ foreach ($propFindRequests as $propFindRequest) {
list($propFind, $node) = $propFindRequest;
$r = $this->getPropertiesByNode($propFind, $node);
@@ -938,7 +937,7 @@ class Server extends EventEmitter {
// principals. This is non-standard, but we support it.
$resourceType = $this->getResourceTypeForNode($node);
if (in_array('{DAV:}collection', $resourceType) || in_array('{DAV:}principal', $resourceType)) {
- $result['href'].='/';
+ $result['href'] .= '/';
}
$returnPropertyList[] = $result;
}
@@ -970,17 +969,17 @@ class Server extends EventEmitter {
$nodes = $this->tree->getMultipleNodes($paths);
- foreach($nodes as $path=>$node) {
+ foreach ($nodes as $path => $node) {
$propFind = new PropFind($path, $propertyNames);
- $r = $this->getPropertiesByNode($propFind,$node);
+ $r = $this->getPropertiesByNode($propFind, $node);
if ($r) {
$result[$path] = $propFind->getResultForMultiStatus();
$result[$path]['href'] = $path;
$resourceType = $this->getResourceTypeForNode($node);
if (in_array('{DAV:}collection', $resourceType) || in_array('{DAV:}principal', $resourceType)) {
- $result[$path]['href'].='/';
+ $result[$path]['href'] .= '/';
}
}
@@ -1025,11 +1024,11 @@ class Server extends EventEmitter {
* @param string $etag
* @return bool
*/
- function createFile($uri,$data, &$etag = null) {
+ function createFile($uri, $data, &$etag = null) {
- list($dir,$name) = URLUtil::splitPath($uri);
+ list($dir, $name) = URLUtil::splitPath($uri);
- if (!$this->emit('beforeBind',[$uri])) return false;
+ if (!$this->emit('beforeBind', [$uri])) return false;
$parent = $this->tree->getNodeForPath($dir);
if (!$parent instanceof ICollection) {
@@ -1042,16 +1041,16 @@ class Server extends EventEmitter {
//
// If $modified is true, we must not send back an ETag.
$modified = false;
- if (!$this->emit('beforeCreateFile',[$uri, &$data, $parent, &$modified])) return false;
+ if (!$this->emit('beforeCreateFile', [$uri, &$data, $parent, &$modified])) return false;
- $etag = $parent->createFile($name,$data);
+ $etag = $parent->createFile($name, $data);
if ($modified) $etag = null;
$this->tree->markDirty($dir . '/' . $name);
- $this->emit('afterBind',[$uri]);
- $this->emit('afterCreateFile',[$uri, $parent]);
+ $this->emit('afterBind', [$uri]);
+ $this->emit('afterCreateFile', [$uri, $parent]);
return true;
}
@@ -1066,7 +1065,7 @@ class Server extends EventEmitter {
* @param string $etag
* @return bool
*/
- function updateFile($uri,$data, &$etag = null) {
+ function updateFile($uri, $data, &$etag = null) {
$node = $this->tree->getNodeForPath($uri);
@@ -1076,11 +1075,11 @@ class Server extends EventEmitter {
//
// If $modified is true, we must not send back an ETag.
$modified = false;
- if (!$this->emit('beforeWriteContent',[$uri, $node, &$data, &$modified])) return false;
+ if (!$this->emit('beforeWriteContent', [$uri, $node, &$data, &$modified])) return false;
$etag = $node->put($data);
if ($modified) $etag = null;
- $this->emit('afterWriteContent',[$uri, $node]);
+ $this->emit('afterWriteContent', [$uri, $node]);
return true;
}
@@ -1108,7 +1107,7 @@ class Server extends EventEmitter {
*/
function createCollection($uri, MkCol $mkCol) {
- list($parentUri,$newName) = URLUtil::splitPath($uri);
+ list($parentUri, $newName) = URLUtil::splitPath($uri);
// Making sure the parent exists
try {
@@ -1136,7 +1135,7 @@ class Server extends EventEmitter {
}
- if (!$this->emit('beforeBind',[$uri])) return;
+ if (!$this->emit('beforeBind', [$uri])) return;
if ($parent instanceof IExtendedCollection) {
@@ -1154,7 +1153,7 @@ class Server extends EventEmitter {
* 'standard' collections can be created, so we should fail any
* MKCOL operation that carries extra resourcetypes.
*/
- if (count($mkCol->getResourceType())>1) {
+ if (count($mkCol->getResourceType()) > 1) {
throw new Exception\InvalidResourceType('The {DAV:}resourcetype you specified is not supported here.');
}
@@ -1178,7 +1177,7 @@ class Server extends EventEmitter {
}
$this->tree->markDirty($parentUri);
- $this->emit('afterBind',[$uri]);
+ $this->emit('afterBind', [$uri]);
}
@@ -1247,27 +1246,27 @@ class Server extends EventEmitter {
try {
$node = $this->tree->getNodeForPath($path);
} catch (Exception\NotFound $e) {
- throw new Exception\PreconditionFailed('An If-Match header was specified and the resource did not exist','If-Match');
+ throw new Exception\PreconditionFailed('An If-Match header was specified and the resource did not exist', 'If-Match');
}
// Only need to check entity tags if they are not *
- if ($ifMatch!=='*') {
+ if ($ifMatch !== '*') {
// There can be multiple ETags
- $ifMatch = explode(',',$ifMatch);
+ $ifMatch = explode(',', $ifMatch);
$haveMatch = false;
- foreach($ifMatch as $ifMatchItem) {
+ foreach ($ifMatch as $ifMatchItem) {
// Stripping any extra spaces
- $ifMatchItem = trim($ifMatchItem,' ');
+ $ifMatchItem = trim($ifMatchItem, ' ');
$etag = $node->getETag();
- if ($etag===$ifMatchItem) {
+ if ($etag === $ifMatchItem) {
$haveMatch = true;
} else {
// Evolution has a bug where it sometimes prepends the "
// with a \. This is our workaround.
- if (str_replace('\\"','"', $ifMatchItem) === $etag) {
+ if (str_replace('\\"', '"', $ifMatchItem) === $etag) {
$haveMatch = true;
}
}
@@ -1275,7 +1274,7 @@ class Server extends EventEmitter {
}
if (!$haveMatch) {
if ($etag) $response->setHeader('ETag', $etag);
- throw new Exception\PreconditionFailed('An If-Match header was specified, but none of the specified the ETags matched.','If-Match');
+ throw new Exception\PreconditionFailed('An If-Match header was specified, but none of the specified the ETags matched.', 'If-Match');
}
}
}
@@ -1296,19 +1295,19 @@ class Server extends EventEmitter {
}
if ($nodeExists) {
$haveMatch = false;
- if ($ifNoneMatch==='*') $haveMatch = true;
+ if ($ifNoneMatch === '*') $haveMatch = true;
else {
// There might be multiple ETags
$ifNoneMatch = explode(',', $ifNoneMatch);
$etag = $node->getETag();
- foreach($ifNoneMatch as $ifNoneMatchItem) {
+ foreach ($ifNoneMatch as $ifNoneMatchItem) {
// Stripping any extra spaces
- $ifNoneMatchItem = trim($ifNoneMatchItem,' ');
+ $ifNoneMatchItem = trim($ifNoneMatchItem, ' ');
- if ($etag===$ifNoneMatchItem) $haveMatch = true;
+ if ($etag === $ifNoneMatchItem) $haveMatch = true;
}
@@ -1316,11 +1315,11 @@ class Server extends EventEmitter {
if ($haveMatch) {
if ($etag) $response->setHeader('ETag', $etag);
- if ($request->getMethod()==='GET') {
+ if ($request->getMethod() === 'GET') {
$response->setStatus(304);
return false;
} else {
- throw new Exception\PreconditionFailed('An If-None-Match header was specified, but the ETag matched (or * was specified).','If-None-Match');
+ throw new Exception\PreconditionFailed('An If-None-Match header was specified, but the ETag matched (or * was specified).', 'If-None-Match');
}
}
}
@@ -1368,7 +1367,7 @@ class Server extends EventEmitter {
if ($lastMod) {
$lastMod = new \DateTime('@' . $lastMod);
if ($lastMod > $date) {
- throw new Exception\PreconditionFailed('An If-Unmodified-Since header was specified, but the entity has been changed since the specified date.','If-Unmodified-Since');
+ throw new Exception\PreconditionFailed('An If-Unmodified-Since header was specified, but the entity has been changed since the specified date.', 'If-Unmodified-Since');
}
}
}
@@ -1385,8 +1384,8 @@ class Server extends EventEmitter {
// Sync and Lock plugin can pick up.
$ifConditions = $this->getIfConditions($request);
- foreach($ifConditions as $kk => $ifCondition) {
- foreach($ifCondition['tokens'] as $ii => $token) {
+ foreach ($ifConditions as $kk => $ifCondition) {
+ foreach ($ifCondition['tokens'] as $ii => $token) {
$ifConditions[$kk]['tokens'][$ii]['validToken'] = false;
}
}
@@ -1400,13 +1399,13 @@ class Server extends EventEmitter {
// Every ifCondition needs to validate to true, so we exit as soon as
// we have an invalid condition.
- foreach($ifConditions as $ifCondition) {
+ foreach ($ifConditions as $ifCondition) {
$uri = $ifCondition['uri'];
$tokens = $ifCondition['tokens'];
// We only need 1 valid token for the condition to succeed.
- foreach($tokens as $token) {
+ foreach ($tokens as $token) {
$tokenValid = $token['validToken'] || !$token['token'];
@@ -1522,20 +1521,20 @@ class Server extends EventEmitter {
$matches = [];
$regex = '/(?:\<(?P<uri>.*?)\>\s)?\((?P<not>Not\s)?(?:\<(?P<token>[^\>]*)\>)?(?:\s?)(?:\[(?P<etag>[^\]]*)\])?\)/im';
- preg_match_all($regex,$header,$matches,PREG_SET_ORDER);
+ preg_match_all($regex, $header, $matches, PREG_SET_ORDER);
$conditions = [];
- foreach($matches as $match) {
+ foreach ($matches as $match) {
// If there was no uri specified in this match, and there were
// already conditions parsed, we add the condition to the list of
// conditions for the previous uri.
if (!$match['uri'] && count($conditions)) {
- $conditions[count($conditions)-1]['tokens'][] = [
- 'negate' => $match['not']?true:false,
+ $conditions[count($conditions) - 1]['tokens'][] = [
+ 'negate' => $match['not'] ? true : false,
'token' => $match['token'],
- 'etag' => isset($match['etag'])?$match['etag']:''
+ 'etag' => isset($match['etag']) ? $match['etag'] : ''
];
} else {
@@ -1546,12 +1545,12 @@ class Server extends EventEmitter {
}
$conditions[] = [
- 'uri' => $realUri,
+ 'uri' => $realUri,
'tokens' => [
[
- 'negate' => $match['not']?true:false,
+ 'negate' => $match['not'] ? true : false,
'token' => $match['token'],
- 'etag' => isset($match['etag'])?$match['etag']:''
+ 'etag' => isset($match['etag']) ? $match['etag'] : ''
]
],
@@ -1573,7 +1572,7 @@ class Server extends EventEmitter {
function getResourceTypeForNode(INode $node) {
$result = [];
- foreach($this->resourceTypeMapping as $className => $resourceType) {
+ foreach ($this->resourceTypeMapping as $className => $resourceType) {
if ($node instanceof $className) $result[] = $resourceType;
}
return $result;
@@ -1597,7 +1596,7 @@ class Server extends EventEmitter {
$xml = [];
- foreach($fileProperties as $entry) {
+ foreach ($fileProperties as $entry) {
$href = $entry['href'];
unset($entry['href']);
@@ -1605,7 +1604,7 @@ class Server extends EventEmitter {
unset($entry[404]);
}
$response = new Xml\Element\Response(
- ltrim($href,'/'),
+ ltrim($href, '/'),
$entry
);
$xml[] = [
diff --git a/lib/DAV/ServerPlugin.php b/lib/DAV/ServerPlugin.php
index 79cc74e..332be01 100644
--- a/lib/DAV/ServerPlugin.php
+++ b/lib/DAV/ServerPlugin.php
@@ -108,4 +108,3 @@ abstract class ServerPlugin {
}
}
-
diff --git a/lib/DAV/SimpleCollection.php b/lib/DAV/SimpleCollection.php
index 070272f..c36aad3 100644
--- a/lib/DAV/SimpleCollection.php
+++ b/lib/DAV/SimpleCollection.php
@@ -40,7 +40,7 @@ class SimpleCollection extends Collection {
function __construct($name, array $children = []) {
$this->name = $name;
- foreach($children as $child) {
+ foreach ($children as $child) {
if (!($child instanceof INode)) throw new Exception('Only instances of Sabre\DAV\INode are allowed to be passed in the children argument');
$this->addChild($child);
diff --git a/lib/DAV/StringUtil.php b/lib/DAV/StringUtil.php
index e7abe73..c861466 100644
--- a/lib/DAV/StringUtil.php
+++ b/lib/DAV/StringUtil.php
@@ -26,13 +26,13 @@ class StringUtil {
*/
static function textMatch($haystack, $needle, $collation, $matchType = 'contains') {
- switch($collation) {
+ switch ($collation) {
case 'i;ascii-casemap' :
// default strtolower takes locale into consideration
// we don't want this.
- $haystack = str_replace(range('a','z'), range('A','Z'), $haystack);
- $needle = str_replace(range('a','z'), range('A','Z'), $needle);
+ $haystack = str_replace(range('a', 'z'), range('A', 'Z'), $haystack);
+ $needle = str_replace(range('a', 'z'), range('A', 'Z'), $needle);
break;
case 'i;octet' :
@@ -49,16 +49,16 @@ class StringUtil {
}
- switch($matchType) {
+ switch ($matchType) {
case 'contains' :
- return strpos($haystack, $needle)!==false;
+ return strpos($haystack, $needle) !== false;
case 'equals' :
return $haystack === $needle;
case 'starts-with' :
- return strpos($haystack, $needle)===0;
+ return strpos($haystack, $needle) === 0;
case 'ends-with' :
- return strrpos($haystack, $needle)===strlen($haystack)-strlen($needle);
+ return strrpos($haystack, $needle) === strlen($haystack) - strlen($needle);
default :
throw new Exception\BadRequest('Match-type: ' . $matchType . ' is not supported');
@@ -78,7 +78,7 @@ class StringUtil {
*/
static function ensureUTF8($input) {
- $encoding = mb_detect_encoding($input , ['UTF-8','ISO-8859-1'], true);
+ $encoding = mb_detect_encoding($input, ['UTF-8', 'ISO-8859-1'], true);
if ($encoding === 'ISO-8859-1') {
return utf8_encode($input);
diff --git a/lib/DAV/Sync/ISyncCollection.php b/lib/DAV/Sync/ISyncCollection.php
index 203f511..90ff874 100644
--- a/lib/DAV/Sync/ISyncCollection.php
+++ b/lib/DAV/Sync/ISyncCollection.php
@@ -86,4 +86,3 @@ interface ISyncCollection extends DAV\ICollection {
function getChanges($syncToken, $syncLevel, $limit = null);
}
-
diff --git a/lib/DAV/Sync/Plugin.php b/lib/DAV/Sync/Plugin.php
index 6f4d97f..d22aa32 100644
--- a/lib/DAV/Sync/Plugin.php
+++ b/lib/DAV/Sync/Plugin.php
@@ -166,13 +166,13 @@ class Plugin extends DAV\ServerPlugin {
$fullPaths = [];
// Pre-fetching children, if this is possible.
- foreach(array_merge($added, $modified) as $item) {
+ foreach (array_merge($added, $modified) as $item) {
$fullPath = $collectionUrl . '/' . $item;
$fullPaths[] = $fullPath;
}
$responses = [];
- foreach($this->server->getPropertiesForMultiplePaths($fullPaths, $properties) as $fullPath => $props) {
+ foreach ($this->server->getPropertiesForMultiplePaths($fullPaths, $properties) as $fullPath => $props) {
// The 'Property_Response' class is responsible for generating a
// single {DAV:}response xml element.
@@ -184,7 +184,7 @@ class Plugin extends DAV\ServerPlugin {
// Deleted items also show up as 'responses'. They have no properties,
// and a single {DAV:}status element set as 'HTTP/1.1 404 Not Found'.
- foreach($deleted as $item) {
+ foreach ($deleted as $item) {
$fullPath = $collectionUrl . '/' . $item;
$responses[] = new DAV\Xml\Element\Response($fullPath, [], 404);
@@ -193,7 +193,7 @@ class Plugin extends DAV\ServerPlugin {
$multiStatus = new DAV\Xml\Response\MultiStatus($responses, self::SYNCTOKEN_PREFIX . $syncToken);
$this->server->httpResponse->setStatus(207);
- $this->server->httpResponse->setHeader('Content-Type','application/xml; charset=utf-8');
+ $this->server->httpResponse->setHeader('Content-Type', 'application/xml; charset=utf-8');
$this->server->httpResponse->setBody(
$this->server->xml->write('{DAV:}multistatus', $multiStatus, $this->server->getBaseUri())
);
@@ -228,11 +228,11 @@ class Plugin extends DAV\ServerPlugin {
* @param mixed $conditions
* @return void
*/
- function validateTokens( RequestInterface $request, &$conditions ) {
+ function validateTokens(RequestInterface $request, &$conditions) {
- foreach($conditions as $kk=>$condition) {
+ foreach ($conditions as $kk => $condition) {
- foreach($condition['tokens'] as $ii=>$token) {
+ foreach ($condition['tokens'] as $ii => $token) {
// Sync-tokens must always start with our designated prefix.
if (substr($token['token'], 0, strlen(self::SYNCTOKEN_PREFIX)) !== self::SYNCTOKEN_PREFIX) {
@@ -277,4 +277,3 @@ class Plugin extends DAV\ServerPlugin {
}
}
-
diff --git a/lib/DAV/TemporaryFileFilterPlugin.php b/lib/DAV/TemporaryFileFilterPlugin.php
index 6166156..65a900b 100644
--- a/lib/DAV/TemporaryFileFilterPlugin.php
+++ b/lib/DAV/TemporaryFileFilterPlugin.php
@@ -74,7 +74,7 @@ class TemporaryFileFilterPlugin extends ServerPlugin {
*/
function __construct($dataDir = null) {
- if (!$dataDir) $dataDir = ini_get('session.save_path').'/sabredav/';
+ if (!$dataDir) $dataDir = ini_get('session.save_path') . '/sabredav/';
if (!is_dir($dataDir)) mkdir($dataDir);
$this->dataDir = $dataDir;
@@ -92,8 +92,8 @@ class TemporaryFileFilterPlugin extends ServerPlugin {
function initialize(Server $server) {
$this->server = $server;
- $server->on('beforeMethod', [$this,'beforeMethod']);
- $server->on('beforeCreateFile',[$this,'beforeCreateFile']);
+ $server->on('beforeMethod', [$this, 'beforeMethod']);
+ $server->on('beforeCreateFile', [$this, 'beforeCreateFile']);
}
@@ -112,7 +112,7 @@ class TemporaryFileFilterPlugin extends ServerPlugin {
if (!$tempLocation = $this->isTempFile($request->getPath()))
return;
- switch($request->getMethod()) {
+ switch ($request->getMethod()) {
case 'GET' :
return $this->httpGet($request, $response, $tempLocation);
case 'PUT' :
@@ -136,13 +136,13 @@ class TemporaryFileFilterPlugin extends ServerPlugin {
* @param resource $data
* @return bool
*/
- function beforeCreateFile($uri,$data) {
+ function beforeCreateFile($uri, $data) {
if ($tempPath = $this->isTempFile($uri)) {
$hR = $this->server->httpResponse;
- $hR->setHeader('X-Sabre-Temp','true');
- file_put_contents($tempPath,$data);
+ $hR->setHeader('X-Sabre-Temp', 'true');
+ file_put_contents($tempPath, $data);
return false;
}
return;
@@ -155,16 +155,16 @@ class TemporaryFileFilterPlugin extends ServerPlugin {
* temporary file storage.
*
* @param string $path
- * @return boolean|string
+ * @return bool|string
*/
protected function isTempFile($path) {
// We're only interested in the basename.
list(, $tempPath) = URLUtil::splitPath($path);
- foreach($this->temporaryFilePatterns as $tempFile) {
+ foreach ($this->temporaryFilePatterns as $tempFile) {
- if (preg_match($tempFile,$tempPath)) {
+ if (preg_match($tempFile, $tempPath)) {
return $this->getDataDir() . '/sabredav_' . md5($path) . '.tempfile';
}
@@ -189,11 +189,11 @@ class TemporaryFileFilterPlugin extends ServerPlugin {
if (!file_exists($tempLocation)) return;
- $hR->setHeader('Content-Type','application/octet-stream');
- $hR->setHeader('Content-Length',filesize($tempLocation));
- $hR->setHeader('X-Sabre-Temp','true');
+ $hR->setHeader('Content-Type', 'application/octet-stream');
+ $hR->setHeader('Content-Length', filesize($tempLocation));
+ $hR->setHeader('X-Sabre-Temp', 'true');
$hR->setStatus(200);
- $hR->setBody(fopen($tempLocation,'r'));
+ $hR->setBody(fopen($tempLocation, 'r'));
return false;
}
@@ -208,7 +208,7 @@ class TemporaryFileFilterPlugin extends ServerPlugin {
*/
function httpPut(RequestInterface $request, ResponseInterface $hR, $tempLocation) {
- $hR->setHeader('X-Sabre-Temp','true');
+ $hR->setHeader('X-Sabre-Temp', 'true');
$newFile = !file_exists($tempLocation);
@@ -216,8 +216,8 @@ class TemporaryFileFilterPlugin extends ServerPlugin {
throw new Exception\PreconditionFailed('The resource already exists, and an If-None-Match header was supplied');
}
- file_put_contents($tempLocation,$this->server->httpRequest->getBody());
- $hR->setStatus($newFile?201:200);
+ file_put_contents($tempLocation, $this->server->httpRequest->getBody());
+ $hR->setStatus($newFile ? 201 : 200);
return false;
}
@@ -238,7 +238,7 @@ class TemporaryFileFilterPlugin extends ServerPlugin {
if (!file_exists($tempLocation)) return;
unlink($tempLocation);
- $hR->setHeader('X-Sabre-Temp','true');
+ $hR->setHeader('X-Sabre-Temp', 'true');
$hR->setStatus(204);
return false;
@@ -260,17 +260,17 @@ class TemporaryFileFilterPlugin extends ServerPlugin {
if (!file_exists($tempLocation)) return;
- $hR->setHeader('X-Sabre-Temp','true');
+ $hR->setHeader('X-Sabre-Temp', 'true');
$hR->setStatus(207);
- $hR->setHeader('Content-Type','application/xml; charset=utf-8');
+ $hR->setHeader('Content-Type', 'application/xml; charset=utf-8');
$properties = [
'href' => $request->getPath(),
- 200 => [
- '{DAV:}getlastmodified' => new Xml\Property\GetLastModified(filemtime($tempLocation)),
- '{DAV:}getcontentlength' => filesize($tempLocation),
- '{DAV:}resourcetype' => new Xml\Property\ResourceType(null),
- '{'.Server::NS_SABREDAV.'}tempFile' => true,
+ 200 => [
+ '{DAV:}getlastmodified' => new Xml\Property\GetLastModified(filemtime($tempLocation)),
+ '{DAV:}getcontentlength' => filesize($tempLocation),
+ '{DAV:}resourcetype' => new Xml\Property\ResourceType(null),
+ '{' . Server::NS_SABREDAV . '}tempFile' => true,
],
];
diff --git a/lib/DAV/Tree.php b/lib/DAV/Tree.php
index f030a19..f6e64bc 100644
--- a/lib/DAV/Tree.php
+++ b/lib/DAV/Tree.php
@@ -52,7 +52,7 @@ class Tree {
*/
function getNodeForPath($path) {
- $path = trim($path,'/');
+ $path = trim($path, '/');
if (isset($this->cache[$path])) return $this->cache[$path];
// Is it the root node?
@@ -64,7 +64,7 @@ class Tree {
list($parentName, $baseName) = URLUtil::splitPath($path);
// If there was no parent, we must simply ask it from the root node.
- if ($parentName==="") {
+ if ($parentName === "") {
$node = $this->rootNode->getChild($baseName);
} else {
// Otherwise, we recursively grab the parent and ask him/her.
@@ -96,7 +96,7 @@ class Tree {
try {
// The root always exists
- if ($path==='') return true;
+ if ($path === '') return true;
list($parent, $base) = URLUtil::splitPath($path);
@@ -127,7 +127,7 @@ class Tree {
list($destinationDir, $destinationName) = URLUtil::splitPath($destinationPath);
$destinationParent = $this->getNodeForPath($destinationDir);
- $this->copyNode($sourceNode,$destinationParent,$destinationName);
+ $this->copyNode($sourceNode, $destinationParent, $destinationName);
$this->markDirty($destinationDir);
@@ -145,7 +145,7 @@ class Tree {
list($sourceDir) = URLUtil::splitPath($sourcePath);
list($destinationDir, $destinationName) = URLUtil::splitPath($destinationPath);
- if ($sourceDir===$destinationDir) {
+ if ($sourceDir === $destinationDir) {
// If this is a 'local' rename, it means we can just trigger a rename.
$sourceNode = $this->getNodeForPath($sourcePath);
$sourceNode->setName($destinationName);
@@ -158,7 +158,7 @@ class Tree {
$moveSuccess = $newParentNode->moveInto($destinationName, $sourcePath, $sourceNode);
}
if (!$moveSuccess) {
- $this->copy($sourcePath,$destinationPath);
+ $this->copy($sourcePath, $destinationPath);
$this->getNodeForPath($sourcePath)->delete();
}
}
@@ -193,8 +193,8 @@ class Tree {
$node = $this->getNodeForPath($path);
$children = $node->getChildren();
- $basePath = trim($path,'/') . '/';
- foreach($children as $child) {
+ $basePath = trim($path, '/') . '/';
+ foreach ($children as $child) {
$this->cache[$basePath . $child->getName()] = $child;
@@ -225,9 +225,9 @@ class Tree {
// We don't care enough about sub-paths
// flushing the entire cache
- $path = trim($path,'/');
- foreach($this->cache as $nodePath=>$node) {
- if ($nodePath == $path || strpos($nodePath,$path.'/')===0)
+ $path = trim($path, '/');
+ foreach ($this->cache as $nodePath => $node) {
+ if ($nodePath == $path || strpos($nodePath, $path . '/') === 0)
unset($this->cache[$nodePath]);
}
@@ -252,7 +252,7 @@ class Tree {
// Finding common parents
$parents = [];
- foreach($paths as $path) {
+ foreach ($paths as $path) {
list($parent, $node) = URLUtil::splitPath($path);
if (!isset($parents[$parent])) {
$parents[$parent] = [$node];
@@ -263,17 +263,17 @@ class Tree {
$result = [];
- foreach($parents as $parent=>$children) {
+ foreach ($parents as $parent => $children) {
$parentNode = $this->getNodeForPath($parent);
if ($parentNode instanceof IMultiGet) {
- foreach($parentNode->getMultipleChildren($children) as $childNode) {
+ foreach ($parentNode->getMultipleChildren($children) as $childNode) {
$fullPath = $parent . '/' . $childNode->getName();
$result[$fullPath] = $childNode;
$this->cache[$fullPath] = $childNode;
}
} else {
- foreach($children as $child) {
+ foreach ($children as $child) {
$fullPath = $parent . '/' . $child;
$result[$fullPath] = $this->getNodeForPath($fullPath);
}
@@ -304,12 +304,12 @@ class Tree {
// If the body was a string, we need to convert it to a stream
if (is_string($data)) {
- $stream = fopen('php://temp','r+');
- fwrite($stream,$data);
+ $stream = fopen('php://temp', 'r+');
+ fwrite($stream, $data);
rewind($stream);
$data = $stream;
}
- $destinationParent->createFile($destinationName,$data);
+ $destinationParent->createFile($destinationName, $data);
$destination = $destinationParent->getChild($destinationName);
} elseif ($source instanceof ICollection) {
@@ -317,9 +317,9 @@ class Tree {
$destinationParent->createDirectory($destinationName);
$destination = $destinationParent->getChild($destinationName);
- foreach($source->getChildren() as $child) {
+ foreach ($source->getChildren() as $child) {
- $this->copyNode($child,$destination);
+ $this->copyNode($child, $destination);
}
@@ -336,4 +336,3 @@ class Tree {
}
}
-
diff --git a/lib/DAV/UUIDUtil.php b/lib/DAV/UUIDUtil.php
index 30178ed..9948eab 100644
--- a/lib/DAV/UUIDUtil.php
+++ b/lib/DAV/UUIDUtil.php
@@ -25,24 +25,24 @@ class UUIDUtil {
*/
static function getUUID() {
- return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
+ return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
// 32 bits for "time_low"
- mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ),
+ mt_rand(0, 0xffff), mt_rand(0, 0xffff),
// 16 bits for "time_mid"
- mt_rand( 0, 0xffff ),
+ mt_rand(0, 0xffff),
// 16 bits for "time_hi_and_version",
// four most significant bits holds version number 4
- mt_rand( 0, 0x0fff ) | 0x4000,
+ mt_rand(0, 0x0fff) | 0x4000,
// 16 bits, 8 bits for "clk_seq_hi_res",
// 8 bits for "clk_seq_low",
// two most significant bits holds zero and one for variant DCE1.1
- mt_rand( 0, 0x3fff ) | 0x8000,
+ mt_rand(0, 0x3fff) | 0x8000,
// 48 bits for "node"
- mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff )
+ mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff)
);
}
diff --git a/lib/DAV/Xml/Element/Prop.php b/lib/DAV/Xml/Element/Prop.php
index 9ae95fa..37de041 100644
--- a/lib/DAV/Xml/Element/Prop.php
+++ b/lib/DAV/Xml/Element/Prop.php
@@ -2,10 +2,9 @@
namespace Sabre\DAV\Xml\Element;
-use
- Sabre\DAV\Xml\Property\Complex,
- Sabre\Xml\XmlDeserializable,
- Sabre\Xml\Reader;
+use Sabre\DAV\Xml\Property\Complex;
+use Sabre\Xml\XmlDeserializable;
+use Sabre\Xml\Reader;
/**
* This class is responsible for decoding the {DAV:}prop element as it appears
@@ -83,31 +82,31 @@ class Prop implements XmlDeserializable {
*
* @return array
*/
- static private function parseCurrentElement(Reader $reader) {
+ private static function parseCurrentElement(Reader $reader) {
$name = $reader->getClark();
if (array_key_exists($name, $reader->elementMap)) {
$deserializer = $reader->elementMap[$name];
if (is_subclass_of($deserializer, 'Sabre\\Xml\\XmlDeserializable')) {
- $value = call_user_func( [ $deserializer, 'xmlDeserialize' ], $reader);
+ $value = call_user_func([ $deserializer, 'xmlDeserialize' ], $reader);
} elseif (is_callable($deserializer)) {
$value = call_user_func($deserializer, $reader);
} else {
$type = gettype($deserializer);
- if ($type==='string') {
- $type.=' (' . $deserializer . ')';
- } elseif ($type==='object') {
- $type.=' (' . get_class($deserializer) . ')';
+ if ($type === 'string') {
+ $type .= ' (' . $deserializer . ')';
+ } elseif ($type === 'object') {
+ $type .= ' (' . get_class($deserializer) . ')';
}
- throw new \LogicException('Could not use this type as a deserializer: ' . $type );
+ throw new \LogicException('Could not use this type as a deserializer: ' . $type);
}
} else {
$value = Complex::xmlDeserialize($reader);
}
return [
- 'name' => $name,
+ 'name' => $name,
'value' => $value,
];
diff --git a/lib/DAV/Xml/Element/Response.php b/lib/DAV/Xml/Element/Response.php
index 66764c4..78673f0 100644
--- a/lib/DAV/Xml/Element/Response.php
+++ b/lib/DAV/Xml/Element/Response.php
@@ -123,7 +123,7 @@ class Response implements Element {
$writer->writeElement('{DAV:}status', 'HTTP/1.1 ' . $status . ' ' . \Sabre\HTTP\Response::$statusCodes[$status]);
}
$writer->writeElement('{DAV:}href', $writer->contextUri . $this->getHref());
- foreach($this->getResponseProperties() as $status => $properties) {
+ foreach ($this->getResponseProperties() as $status => $properties) {
// Skipping empty lists
if (!$properties || (!ctype_digit($status) && !is_int($status))) {
@@ -167,21 +167,21 @@ class Response implements Element {
$propertyLists = [];
$statusCode = null;
- foreach($elems as $elem) {
+ foreach ($elems as $elem) {
- switch($elem['name']) {
+ switch ($elem['name']) {
case '{DAV:}href' :
$href = $elem['value'];
break;
case '{DAV:}propstat' :
$status = $elem['value']['{DAV:}status'];
- list(, $status, ) = explode(' ', $status,3);
+ list(, $status, ) = explode(' ', $status, 3);
$properties = $elem['value']['{DAV:}prop'];
$propertyLists[$status] = $properties;
break;
case '{DAV:}status' :
- list(, $statusCode, ) = explode(' ', $elem['value'],3);
+ list(, $statusCode, ) = explode(' ', $elem['value'], 3);
break;
}
diff --git a/lib/DAV/Xml/Property/Complex.php b/lib/DAV/Xml/Property/Complex.php
index 7d14b4c..9cfe104 100644
--- a/lib/DAV/Xml/Property/Complex.php
+++ b/lib/DAV/Xml/Property/Complex.php
@@ -2,9 +2,8 @@
namespace Sabre\DAV\Xml\Property;
-use
- Sabre\Xml\Element\XmlFragment,
- Sabre\Xml\Reader;
+use Sabre\Xml\Element\XmlFragment;
+use Sabre\Xml\Reader;
/**
* This class represents a 'complex' property that didn't have a default
@@ -56,16 +55,16 @@ class Complex extends XmlFragment {
$nonText = false;
$text = '';
- while(true) {
+ while (true) {
- switch($reader->nodeType) {
+ switch ($reader->nodeType) {
case Reader::ELEMENT :
$nonText = true;
$reader->next();
continue 2;
case Reader::TEXT :
case Reader::CDATA :
- $text.=$reader->value;
+ $text .= $reader->value;
break;
case Reader::END_ELEMENT :
break 2;
@@ -88,4 +87,3 @@ class Complex extends XmlFragment {
}
-
diff --git a/lib/DAV/Xml/Property/GetLastModified.php b/lib/DAV/Xml/Property/GetLastModified.php
index f5c7ad1..bf57508 100644
--- a/lib/DAV/Xml/Property/GetLastModified.php
+++ b/lib/DAV/Xml/Property/GetLastModified.php
@@ -2,13 +2,12 @@
namespace Sabre\DAV\Xml\Property;
-use
- Sabre\Xml\Element,
- Sabre\Xml\Reader,
- Sabre\Xml\Writer,
- Sabre\HTTP,
- DateTime,
- DateTimeZone;
+use Sabre\Xml\Element;
+use Sabre\Xml\Reader;
+use Sabre\Xml\Writer;
+use Sabre\HTTP;
+use DateTime;
+use DateTimeZone;
/**
* This property represents the {DAV:}getlastmodified property.
@@ -30,7 +29,7 @@ class GetLastModified implements Element {
public $time;
/**
- * Constructor
+ * Constructor
*
* @param int|DateTime $time
*/
@@ -109,4 +108,3 @@ class GetLastModified implements Element {
}
}
-
diff --git a/lib/DAV/Xml/Property/Href.php b/lib/DAV/Xml/Property/Href.php
index f98c0f1..4462ee1 100644
--- a/lib/DAV/Xml/Property/Href.php
+++ b/lib/DAV/Xml/Property/Href.php
@@ -103,7 +103,7 @@ class Href implements Element, HtmlOutput {
*/
function xmlSerialize(Writer $writer) {
- foreach($this->getHrefs() as $href) {
+ foreach ($this->getHrefs() as $href) {
if ($this->autoPrefix) {
$href = $writer->contextUri . $href;
}
@@ -129,7 +129,7 @@ class Href implements Element, HtmlOutput {
function toHtml(HtmlOutputHelper $html) {
$links = [];
- foreach($this->getHrefs() as $href) {
+ foreach ($this->getHrefs() as $href) {
$links[] = $html->link($href);
}
return implode('<br />', $links);
@@ -160,7 +160,7 @@ class Href implements Element, HtmlOutput {
static function xmlDeserialize(Reader $reader) {
$hrefs = [];
- foreach($reader->parseInnerTree() as $elem) {
+ foreach ($reader->parseInnerTree() as $elem) {
if ($elem['name'] !== '{DAV:}href')
continue;
diff --git a/lib/DAV/Xml/Property/LockDiscovery.php b/lib/DAV/Xml/Property/LockDiscovery.php
index 1892746..7b3a595 100644
--- a/lib/DAV/Xml/Property/LockDiscovery.php
+++ b/lib/DAV/Xml/Property/LockDiscovery.php
@@ -2,13 +2,11 @@
namespace Sabre\DAV\Xml\Property;
-use
- Sabre\DAV,
- Sabre\DAV\Locks\LockInfo,
- Sabre\Xml\Element\XmlFragment,
- Sabre\Xml\Writer,
- Sabre\Xml\XmlSerializable;
-
+use Sabre\DAV;
+use Sabre\DAV\Locks\LockInfo;
+use Sabre\Xml\Element\XmlFragment;
+use Sabre\Xml\Writer;
+use Sabre\Xml\XmlSerializable;
/**
* Represents {DAV:}lockdiscovery property.
@@ -39,7 +37,7 @@ class LockDiscovery implements XmlSerializable {
*
* @var bool
*/
- static public $hideLockRoot = false;
+ static $hideLockRoot = false;
/**
* __construct
@@ -69,7 +67,7 @@ class LockDiscovery implements XmlSerializable {
*/
function xmlSerialize(Writer $writer) {
- foreach($this->locks as $lock) {
+ foreach ($this->locks as $lock) {
$writer->startElement('{DAV:}activelock');
@@ -91,8 +89,8 @@ class LockDiscovery implements XmlSerializable {
$writer->writeElement('{DAV:}href', $writer->contextUri . $lock->uri);
$writer->endElement(); // {DAV:}lockroot
}
- $writer->writeElement('{DAV:}depth', ($lock->depth == DAV\Server::DEPTH_INFINITY?'infinity':$lock->depth));
- $writer->writeElement('{DAV:}timeout','Second-' . $lock->timeout);
+ $writer->writeElement('{DAV:}depth', ($lock->depth == DAV\Server::DEPTH_INFINITY ? 'infinity' : $lock->depth));
+ $writer->writeElement('{DAV:}timeout', 'Second-' . $lock->timeout);
$writer->startElement('{DAV:}locktoken');
$writer->writeElement('{DAV:}href', 'opaquelocktoken:' . $lock->token);
@@ -106,4 +104,3 @@ class LockDiscovery implements XmlSerializable {
}
}
-
diff --git a/lib/DAV/Xml/Property/SupportedLock.php b/lib/DAV/Xml/Property/SupportedLock.php
index af69c05..1a6b360 100644
--- a/lib/DAV/Xml/Property/SupportedLock.php
+++ b/lib/DAV/Xml/Property/SupportedLock.php
@@ -2,9 +2,8 @@
namespace Sabre\DAV\Xml\Property;
-use
- Sabre\Xml\Writer,
- Sabre\Xml\XmlSerializable;
+use Sabre\Xml\Writer;
+use Sabre\Xml\XmlSerializable;
/**
* This class represents the {DAV:}supportedlock property.
@@ -44,13 +43,12 @@ class SupportedLock implements XmlSerializable {
$writer->writeElement('{DAV:}lockentry', [
'{DAV:}lockscope' => ['{DAV:}exclusive' => null],
- '{DAV:}locktype' => ['{DAV:}write' => null],
+ '{DAV:}locktype' => ['{DAV:}write' => null],
]);
$writer->writeElement('{DAV:}lockentry', [
'{DAV:}lockscope' => ['{DAV:}shared' => null],
- '{DAV:}locktype' => ['{DAV:}write' => null],
+ '{DAV:}locktype' => ['{DAV:}write' => null],
]);
}
}
-
diff --git a/lib/DAV/Xml/Property/SupportedMethodSet.php b/lib/DAV/Xml/Property/SupportedMethodSet.php
index 8be970c..aa4fb17 100644
--- a/lib/DAV/Xml/Property/SupportedMethodSet.php
+++ b/lib/DAV/Xml/Property/SupportedMethodSet.php
@@ -92,7 +92,7 @@ class SupportedMethodSet implements XmlSerializable, HtmlOutput {
*/
function xmlSerialize(Writer $writer) {
- foreach($this->getValue() as $val) {
+ foreach ($this->getValue() as $val) {
$writer->startElement('{DAV:}supported-method');
$writer->writeAttribute('name', $val);
$writer->endElement();
diff --git a/lib/DAV/Xml/Property/SupportedReportSet.php b/lib/DAV/Xml/Property/SupportedReportSet.php
index e856ad5..701296b 100644
--- a/lib/DAV/Xml/Property/SupportedReportSet.php
+++ b/lib/DAV/Xml/Property/SupportedReportSet.php
@@ -60,9 +60,9 @@ class SupportedReportSet implements XmlSerializable, HtmlOutput {
$report = (array)$report;
- foreach($report as $r) {
+ foreach ($report as $r) {
- if (!preg_match('/^{([^}]*)}(.*)$/',$r))
+ if (!preg_match('/^{([^}]*)}(.*)$/', $r))
throw new DAV\Exception('Reportname must be in clark-notation');
$this->reports[] = $r;
@@ -118,7 +118,7 @@ class SupportedReportSet implements XmlSerializable, HtmlOutput {
*/
function xmlSerialize(Writer $writer) {
- foreach($this->getValue() as $val) {
+ foreach ($this->getValue() as $val) {
$writer->startElement('{DAV:}supported-report');
$writer->startElement('{DAV:}report');
$writer->writeElement($val);
diff --git a/lib/DAV/Xml/Request/Lock.php b/lib/DAV/Xml/Request/Lock.php
index 882f843..b2e68e5 100644
--- a/lib/DAV/Xml/Request/Lock.php
+++ b/lib/DAV/Xml/Request/Lock.php
@@ -66,11 +66,11 @@ class Lock implements XmlDeserializable {
$reader->popContext();
$new = new self();
- $new->owner = !empty($values['{DAV:}owner'])?$values['{DAV:}owner']->getXml():null;
+ $new->owner = !empty($values['{DAV:}owner']) ? $values['{DAV:}owner']->getXml() : null;
$new->scope = LockInfo::SHARED;
if (isset($values['{DAV:}lockscope'])) {
- foreach($values['{DAV:}lockscope'] as $elem) {
+ foreach ($values['{DAV:}lockscope'] as $elem) {
if ($elem['name'] === '{DAV:}exclusive') $new->scope = LockInfo::EXCLUSIVE;
}
}
diff --git a/lib/DAV/Xml/Request/MkCol.php b/lib/DAV/Xml/Request/MkCol.php
index 30fd14a..582dee0 100644
--- a/lib/DAV/Xml/Request/MkCol.php
+++ b/lib/DAV/Xml/Request/MkCol.php
@@ -69,7 +69,7 @@ class MkCol implements XmlDeserializable {
$elems = $reader->parseInnerTree($elementMap);
- foreach($elems as $elem) {
+ foreach ($elems as $elem) {
if ($elem['name'] === '{DAV:}set') {
$self->properties = array_merge($self->properties, $elem['value']['{DAV:}prop']);
}
diff --git a/lib/DAV/Xml/Request/PropFind.php b/lib/DAV/Xml/Request/PropFind.php
index e7fb9e0..5492668 100644
--- a/lib/DAV/Xml/Request/PropFind.php
+++ b/lib/DAV/Xml/Request/PropFind.php
@@ -61,9 +61,9 @@ class PropFind implements XmlDeserializable {
$reader->pushContext();
$reader->elementMap['{DAV:}prop'] = 'Sabre\Xml\Element\Elements';
- foreach(KeyValue::xmlDeserialize($reader) as $k=>$v) {
+ foreach (KeyValue::xmlDeserialize($reader) as $k => $v) {
- switch($k) {
+ switch ($k) {
case '{DAV:}prop' :
$self->properties = $v;
break;
diff --git a/lib/DAV/Xml/Request/PropPatch.php b/lib/DAV/Xml/Request/PropPatch.php
index 9d9ecbf..72f296c 100644
--- a/lib/DAV/Xml/Request/PropPatch.php
+++ b/lib/DAV/Xml/Request/PropPatch.php
@@ -59,14 +59,14 @@ class PropPatch implements XmlDeserializable {
$elems = $reader->parseInnerTree($elementMap);
- foreach($elems as $elem) {
+ foreach ($elems as $elem) {
if ($elem['name'] === '{DAV:}set') {
$self->properties = array_merge($self->properties, $elem['value']['{DAV:}prop']);
}
if ($elem['name'] === '{DAV:}remove') {
// Ensuring there are no values.
- foreach($elem['value']['{DAV:}prop'] as $remove=>$value) {
+ foreach ($elem['value']['{DAV:}prop'] as $remove => $value) {
$self->properties[$remove] = null;
}
diff --git a/lib/DAV/Xml/Request/SyncCollectionReport.php b/lib/DAV/Xml/Request/SyncCollectionReport.php
index 2d41850..c31dac9 100644
--- a/lib/DAV/Xml/Request/SyncCollectionReport.php
+++ b/lib/DAV/Xml/Request/SyncCollectionReport.php
@@ -85,9 +85,9 @@ class SyncCollectionReport implements XmlDeserializable {
'{DAV:}prop',
];
- foreach($required as $elem) {
+ foreach ($required as $elem) {
if (!array_key_exists($elem, $elems)) {
- throw new BadRequest('The '.$elem.' element in the {DAV:}sync-collection report is required');
+ throw new BadRequest('The ' . $elem . ' element in the {DAV:}sync-collection report is required');
}
}
@@ -97,7 +97,7 @@ class SyncCollectionReport implements XmlDeserializable {
if (isset($elems['{DAV:}limit'])) {
$nresults = null;
- foreach($elems['{DAV:}limit'] as $child) {
+ foreach ($elems['{DAV:}limit'] as $child) {
if ($child['name'] === '{DAV:}nresults') {
$nresults = (int)$child['value'];
}
@@ -108,7 +108,7 @@ class SyncCollectionReport implements XmlDeserializable {
if (isset($elems['{DAV:}sync-level'])) {
$value = $elems['{DAV:}sync-level'];
- if ($value==='infinity') {
+ if ($value === 'infinity') {
$value = \Sabre\DAV\Server::DEPTH_INFINITY;
}
$self->syncLevel = $value;
diff --git a/lib/DAV/Xml/Response/MultiStatus.php b/lib/DAV/Xml/Response/MultiStatus.php
index 0c46dc0..9b8cd1a 100644
--- a/lib/DAV/Xml/Response/MultiStatus.php
+++ b/lib/DAV/Xml/Response/MultiStatus.php
@@ -86,7 +86,7 @@ class MultiStatus implements Element {
*/
function xmlSerialize(Writer $writer) {
- foreach($this->getResponses() as $response) {
+ foreach ($this->getResponses() as $response) {
$writer->writeElement('{DAV:}response', $response);
}
if ($syncToken = $this->getSyncToken()) {
@@ -125,7 +125,7 @@ class MultiStatus implements Element {
$responses = [];
$syncToken = null;
- if ($elements) foreach($elements as $elem) {
+ if ($elements) foreach ($elements as $elem) {
if ($elem['name'] === '{DAV:}response') {
$responses[] = $elem['value'];
}
diff --git a/lib/DAVACL/AbstractPrincipalCollection.php b/lib/DAVACL/AbstractPrincipalCollection.php
index c63f9f1..acf12cc 100644
--- a/lib/DAVACL/AbstractPrincipalCollection.php
+++ b/lib/DAVACL/AbstractPrincipalCollection.php
@@ -2,9 +2,8 @@
namespace Sabre\DAVACL;
-use
- Sabre\DAV,
- Sabre\HTTP\URLUtil;
+use Sabre\DAV;
+use Sabre\HTTP\URLUtil;
/**
* Principals Collection
@@ -80,7 +79,7 @@ abstract class AbstractPrincipalCollection extends DAV\Collection implements IPr
*/
function getName() {
- list(,$name) = URLUtil::splitPath($this->principalPrefix);
+ list(, $name) = URLUtil::splitPath($this->principalPrefix);
return $name;
}
@@ -96,7 +95,7 @@ abstract class AbstractPrincipalCollection extends DAV\Collection implements IPr
throw new DAV\Exception\MethodNotAllowed('Listing members of this collection is disabled');
$children = [];
- foreach($this->principalBackend->getPrincipalsByPrefix($this->principalPrefix) as $principalInfo) {
+ foreach ($this->principalBackend->getPrincipalsByPrefix($this->principalPrefix) as $principalInfo) {
$children[] = $this->getChildForPrincipal($principalInfo);
@@ -148,7 +147,7 @@ abstract class AbstractPrincipalCollection extends DAV\Collection implements IPr
$result = $this->principalBackend->searchPrincipals($this->principalPrefix, $searchProperties, $test);
$r = [];
- foreach($result as $row) {
+ foreach ($result as $row) {
list(, $r[]) = URLUtil::splitPath($row);
}
diff --git a/lib/DAVACL/Exception/AceConflict.php b/lib/DAVACL/Exception/AceConflict.php
index 5fd521a..b824e8f 100644
--- a/lib/DAVACL/Exception/AceConflict.php
+++ b/lib/DAVACL/Exception/AceConflict.php
@@ -23,11 +23,11 @@ class AceConflict extends DAV\Exception\Conflict {
* @param \DOMElement $errorNode
* @return void
*/
- function serialize(DAV\Server $server,\DOMElement $errorNode) {
+ function serialize(DAV\Server $server, \DOMElement $errorNode) {
$doc = $errorNode->ownerDocument;
- $np = $doc->createElementNS('DAV:','d:no-ace-conflict');
+ $np = $doc->createElementNS('DAV:', 'd:no-ace-conflict');
$errorNode->appendChild($np);
}
diff --git a/lib/DAVACL/Exception/NeedPrivileges.php b/lib/DAVACL/Exception/NeedPrivileges.php
index 12a6ddf..6f26871 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
*/
- function __construct($uri,array $privileges) {
+ function __construct($uri, array $privileges) {
$this->uri = $uri;
$this->privileges = $privileges;
@@ -54,25 +54,25 @@ class NeedPrivileges extends DAV\Exception\Forbidden {
* @param \DOMElement $errorNode
* @return void
*/
- function serialize(DAV\Server $server,\DOMElement $errorNode) {
+ function serialize(DAV\Server $server, \DOMElement $errorNode) {
$doc = $errorNode->ownerDocument;
- $np = $doc->createElementNS('DAV:','d:need-privileges');
+ $np = $doc->createElementNS('DAV:', 'd:need-privileges');
$errorNode->appendChild($np);
- foreach($this->privileges as $privilege) {
+ foreach ($this->privileges as $privilege) {
- $resource = $doc->createElementNS('DAV:','d:resource');
+ $resource = $doc->createElementNS('DAV:', 'd:resource');
$np->appendChild($resource);
- $resource->appendChild($doc->createElementNS('DAV:','d:href',$server->getBaseUri() . $this->uri));
+ $resource->appendChild($doc->createElementNS('DAV:', 'd:href', $server->getBaseUri() . $this->uri));
- $priv = $doc->createElementNS('DAV:','d:privilege');
+ $priv = $doc->createElementNS('DAV:', 'd:privilege');
$resource->appendChild($priv);
- preg_match('/^{([^}]*)}(.*)$/',$privilege,$privilegeParts);
- $priv->appendChild($doc->createElementNS($privilegeParts[1],'d:' . $privilegeParts[2]));
+ preg_match('/^{([^}]*)}(.*)$/', $privilege, $privilegeParts);
+ $priv->appendChild($doc->createElementNS($privilegeParts[1], 'd:' . $privilegeParts[2]));
}
@@ -80,4 +80,3 @@ class NeedPrivileges extends DAV\Exception\Forbidden {
}
}
-
diff --git a/lib/DAVACL/Exception/NoAbstract.php b/lib/DAVACL/Exception/NoAbstract.php
index 1fb0f36..9d5151b 100644
--- a/lib/DAVACL/Exception/NoAbstract.php
+++ b/lib/DAVACL/Exception/NoAbstract.php
@@ -23,11 +23,11 @@ class NoAbstract extends DAV\Exception\PreconditionFailed {
* @param \DOMElement $errorNode
* @return void
*/
- function serialize(DAV\Server $server,\DOMElement $errorNode) {
+ function serialize(DAV\Server $server, \DOMElement $errorNode) {
$doc = $errorNode->ownerDocument;
- $np = $doc->createElementNS('DAV:','d:no-abstract');
+ $np = $doc->createElementNS('DAV:', 'd:no-abstract');
$errorNode->appendChild($np);
}
diff --git a/lib/DAVACL/Exception/NotRecognizedPrincipal.php b/lib/DAVACL/Exception/NotRecognizedPrincipal.php
index 17242ce..e4f48cb 100644
--- a/lib/DAVACL/Exception/NotRecognizedPrincipal.php
+++ b/lib/DAVACL/Exception/NotRecognizedPrincipal.php
@@ -23,11 +23,11 @@ class NotRecognizedPrincipal extends DAV\Exception\PreconditionFailed {
* @param \DOMElement $errorNode
* @return void
*/
- function serialize(DAV\Server $server,\DOMElement $errorNode) {
+ function serialize(DAV\Server $server, \DOMElement $errorNode) {
$doc = $errorNode->ownerDocument;
- $np = $doc->createElementNS('DAV:','d:recognized-principal');
+ $np = $doc->createElementNS('DAV:', 'd:recognized-principal');
$errorNode->appendChild($np);
}
diff --git a/lib/DAVACL/Exception/NotSupportedPrivilege.php b/lib/DAVACL/Exception/NotSupportedPrivilege.php
index fe65b34..acbffad 100644
--- a/lib/DAVACL/Exception/NotSupportedPrivilege.php
+++ b/lib/DAVACL/Exception/NotSupportedPrivilege.php
@@ -23,11 +23,11 @@ class NotSupportedPrivilege extends DAV\Exception\PreconditionFailed {
* @param \DOMElement $errorNode
* @return void
*/
- function serialize(DAV\Server $server,\DOMElement $errorNode) {
+ function serialize(DAV\Server $server, \DOMElement $errorNode) {
$doc = $errorNode->ownerDocument;
- $np = $doc->createElementNS('DAV:','d:not-supported-privilege');
+ $np = $doc->createElementNS('DAV:', 'd:not-supported-privilege');
$errorNode->appendChild($np);
}
diff --git a/lib/DAVACL/IACL.php b/lib/DAVACL/IACL.php
index 92970c7..e55111f 100644
--- a/lib/DAVACL/IACL.php
+++ b/lib/DAVACL/IACL.php
@@ -1,6 +1,7 @@
<?php
namespace Sabre\DAVACL;
+
use Sabre\DAV;
/**
diff --git a/lib/DAVACL/Plugin.php b/lib/DAVACL/Plugin.php
index 59f8b37..18e760f 100644
--- a/lib/DAVACL/Plugin.php
+++ b/lib/DAVACL/Plugin.php
@@ -95,7 +95,7 @@ class Plugin extends DAV\ServerPlugin {
* @var array
*/
public $principalSearchPropertySet = [
- '{DAV:}displayname' => 'Display name',
+ '{DAV:}displayname' => 'Display name',
'{http://sabredav.org/ns}email-address' => 'Email address',
];
@@ -193,7 +193,7 @@ class Plugin extends DAV\ServerPlugin {
return true;
} else {
if ($throwExceptions)
- throw new Exception\NeedPrivileges($uri,$privileges);
+ throw new Exception\NeedPrivileges($uri, $privileges);
else
return false;
@@ -201,7 +201,7 @@ class Plugin extends DAV\ServerPlugin {
}
$failed = [];
- foreach($privileges as $priv) {
+ foreach ($privileges as $priv) {
if (!in_array($priv, $acl)) {
$failed[] = $priv;
@@ -211,7 +211,7 @@ class Plugin extends DAV\ServerPlugin {
if ($failed) {
if ($throwExceptions)
- throw new Exception\NeedPrivileges($uri,$failed);
+ throw new Exception\NeedPrivileges($uri, $failed);
else
return false;
}
@@ -282,13 +282,13 @@ class Plugin extends DAV\ServerPlugin {
$check = [$mainPrincipal];
$principals = [];
- while(count($check)) {
+ while (count($check)) {
$principal = array_shift($check);
$node = $this->server->tree->getNodeForPath($principal);
if ($node instanceof IPrincipal) {
- foreach($node->getGroupMembership() as $groupMember) {
+ foreach ($node->getGroupMembership() as $groupMember) {
if (!in_array($groupMember, $principals)) {
@@ -417,18 +417,18 @@ class Plugin extends DAV\ServerPlugin {
$privs = $this->getSupportedPrivilegeSet($node);
$fpsTraverse = null;
- $fpsTraverse = function ($priv, $concrete, &$flat) use (&$fpsTraverse) {
+ $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'],
+ 'concrete' => isset($priv['abstract']) && $priv['abstract'] ? $concrete : $priv['privilege'],
];
if (isset($priv['aggregates'])) {
- foreach($priv['aggregates'] as $subPriv) {
+ foreach ($priv['aggregates'] as $subPriv) {
$myPriv['aggregates'][] = $subPriv['privilege'];
@@ -440,7 +440,7 @@ class Plugin extends DAV\ServerPlugin {
if (isset($priv['aggregates'])) {
- foreach($priv['aggregates'] as $subPriv) {
+ foreach ($priv['aggregates'] as $subPriv) {
$fpsTraverse($subPriv, $myPriv['concrete'], $flat);
@@ -476,7 +476,7 @@ class Plugin extends DAV\ServerPlugin {
return null;
}
$acl = $node->getACL();
- foreach($this->adminPrincipals as $adminPrincipal) {
+ foreach ($this->adminPrincipals as $adminPrincipal) {
$acl[] = [
'principal' => $adminPrincipal,
'privilege' => '{DAV:}all',
@@ -512,11 +512,11 @@ class Plugin extends DAV\ServerPlugin {
$collected = [];
- foreach($acl as $ace) {
+ foreach ($acl as $ace) {
$principal = $ace['principal'];
- switch($principal) {
+ switch ($principal) {
case '{DAV:}owner' :
$owner = $node->getOwner();
@@ -556,12 +556,12 @@ class Plugin extends DAV\ServerPlugin {
$flat = $this->getFlatPrivilegeSet($node);
$collected2 = [];
- while(count($collected)) {
+ while (count($collected)) {
$current = array_pop($collected);
$collected2[] = $current['privilege'];
- foreach($flat[$current['privilege']]['aggregates'] as $subPriv) {
+ foreach ($flat[$current['privilege']]['aggregates'] as $subPriv) {
$collected2[] = $subPriv;
$collected[] = $flat[$subPriv];
}
@@ -585,7 +585,7 @@ class Plugin extends DAV\ServerPlugin {
$result = null;
$collections = $this->principalCollectionSet;
- foreach($collections as $collection) {
+ foreach ($collections as $collection) {
$principalCollection = $this->server->tree->getNodeForPath($collection);
if (!$principalCollection instanceof IPrincipalCollection) {
@@ -625,7 +625,6 @@ class Plugin extends DAV\ServerPlugin {
* @return array This method returns an array structure similar to
* Sabre\DAV\Server::getPropertiesForPath. Returned
* properties are index by a HTTP status code.
- *
*/
function principalSearch(array $searchProperties, array $requestedProperties, $collectionUri = null, $test = 'allof') {
@@ -636,7 +635,7 @@ class Plugin extends DAV\ServerPlugin {
}
$lookupResults = [];
- foreach($uris as $uri) {
+ foreach ($uris as $uri) {
$principalCollection = $this->server->tree->getNodeForPath($uri);
if (!$principalCollection instanceof IPrincipalCollection) {
@@ -646,15 +645,15 @@ class Plugin extends DAV\ServerPlugin {
}
$results = $principalCollection->searchPrincipals($searchProperties, $test);
- foreach($results as $result) {
- $lookupResults[] = rtrim($uri,'/') . '/' . $result;
+ foreach ($results as $result) {
+ $lookupResults[] = rtrim($uri, '/') . '/' . $result;
}
}
$matches = [];
- foreach($lookupResults as $lookupResult) {
+ foreach ($lookupResults as $lookupResult) {
list($matches[]) = $this->server->getPropertiesForPath($lookupResult, $requestedProperties, 0);
@@ -675,15 +674,15 @@ class Plugin extends DAV\ServerPlugin {
function initialize(DAV\Server $server) {
$this->server = $server;
- $server->on('propFind', [$this,'propFind'], 20);
- $server->on('beforeMethod', [$this,'beforeMethod'],20);
- $server->on('beforeBind', [$this,'beforeBind'],20);
- $server->on('beforeUnbind', [$this,'beforeUnbind'],20);
- $server->on('propPatch', [$this,'propPatch']);
- $server->on('beforeUnlock', [$this,'beforeUnlock'],20);
- $server->on('report', [$this,'report']);
- $server->on('method:ACL', [$this,'httpAcl']);
- $server->on('onHTMLActionsPanel', [$this,'htmlActionsPanel']);
+ $server->on('propFind', [$this, 'propFind'], 20);
+ $server->on('beforeMethod', [$this, 'beforeMethod'], 20);
+ $server->on('beforeBind', [$this, 'beforeBind'], 20);
+ $server->on('beforeUnbind', [$this, 'beforeUnbind'], 20);
+ $server->on('propPatch', [$this, 'propPatch']);
+ $server->on('beforeUnlock', [$this, 'beforeUnlock'], 20);
+ $server->on('report', [$this, 'report']);
+ $server->on('method:ACL', [$this, 'httpAcl']);
+ $server->on('onHTMLActionsPanel', [$this, 'htmlActionsPanel']);
array_push($server->protectedProperties,
'{DAV:}alternate-URI-set',
@@ -733,13 +732,13 @@ class Plugin extends DAV\ServerPlugin {
// If the node doesn't exists, none of these checks apply
if (!$exists) return;
- switch($method) {
+ switch ($method) {
case 'GET' :
case 'HEAD' :
case 'OPTIONS' :
// For these 3 we only need to know if the node is readable.
- $this->checkPrivileges($path,'{DAV:}read');
+ $this->checkPrivileges($path, '{DAV:}read');
break;
case 'PUT' :
@@ -749,16 +748,16 @@ class Plugin extends DAV\ServerPlugin {
// already exists, and bind on the parent if the node is being
// created.
// The bind privilege is handled in the beforeBind event.
- $this->checkPrivileges($path,'{DAV:}write-content');
+ $this->checkPrivileges($path, '{DAV:}write-content');
break;
case 'PROPPATCH' :
- $this->checkPrivileges($path,'{DAV:}write-properties');
+ $this->checkPrivileges($path, '{DAV:}write-properties');
break;
case 'ACL' :
- $this->checkPrivileges($path,'{DAV:}write-acl');
+ $this->checkPrivileges($path, '{DAV:}write-acl');
break;
case 'COPY' :
@@ -774,7 +773,7 @@ class Plugin extends DAV\ServerPlugin {
//
// If MOVE is used beforeUnbind will also be used to check if
// the sourcenode can be deleted.
- $this->checkPrivileges($path,'{DAV:}read',self::R_RECURSIVE);
+ $this->checkPrivileges($path, '{DAV:}read', self::R_RECURSIVE);
break;
@@ -794,7 +793,7 @@ class Plugin extends DAV\ServerPlugin {
function beforeBind($uri) {
list($parentUri) = Uri\split($uri);
- $this->checkPrivileges($parentUri,'{DAV:}bind');
+ $this->checkPrivileges($parentUri, '{DAV:}bind');
}
@@ -810,7 +809,7 @@ class Plugin extends DAV\ServerPlugin {
function beforeUnbind($uri) {
list($parentUri) = Uri\split($uri);
- $this->checkPrivileges($parentUri,'{DAV:}unbind',self::R_RECURSIVEPARENTS);
+ $this->checkPrivileges($parentUri, '{DAV:}unbind', self::R_RECURSIVEPARENTS);
}
@@ -842,7 +841,7 @@ class Plugin extends DAV\ServerPlugin {
$path = $propFind->getPath();
// Checking the read permission
- if (!$this->checkPrivileges($path,'{DAV:}read',self::R_PARENT,false)) {
+ if (!$this->checkPrivileges($path, '{DAV:}read', self::R_PARENT, false)) {
// User is not allowed to read properties
// Returning false causes the property-fetching system to pretend
@@ -853,7 +852,7 @@ class Plugin extends DAV\ServerPlugin {
}
// Otherwise we simply mark every property as 403.
- foreach($propFind->getRequestedProperties() as $requestedProperty) {
+ foreach ($propFind->getRequestedProperties() as $requestedProperty) {
$propFind->set($requestedProperty, null, 403);
}
@@ -872,15 +871,15 @@ class Plugin extends DAV\ServerPlugin {
});
$propFind->handle('{DAV:}group-member-set', function() use ($node) {
$members = $node->getGroupMemberSet();
- foreach($members as $k=>$member) {
- $members[$k] = rtrim($member,'/') . '/';
+ foreach ($members as $k => $member) {
+ $members[$k] = rtrim($member, '/') . '/';
}
return new DAV\Xml\Property\Href($members);
});
$propFind->handle('{DAV:}group-membership', function() use ($node) {
$members = $node->getGroupMembership();
- foreach($members as $k=>$member) {
- $members[$k] = rtrim($member,'/') . '/';
+ foreach ($members as $k => $member) {
+ $members[$k] = rtrim($member, '/') . '/';
}
return new DAV\Xml\Property\Href($members);
});
@@ -892,7 +891,7 @@ class Plugin extends DAV\ServerPlugin {
$val = $this->principalCollectionSet;
// Ensuring all collections end with a slash
- foreach($val as $k=>$v) $val[$k] = $v . '/';
+ foreach ($val as $k => $v) $val[$k] = $v . '/';
return new DAV\Xml\Property\Href($val);
});
@@ -955,7 +954,7 @@ class Plugin extends DAV\ServerPlugin {
$memberSet = [];
} elseif ($value instanceof DAV\Xml\Property\Href) {
$memberSet = array_map(
- [$this->server,'calculateUri'],
+ [$this->server, 'calculateUri'],
$value->getHrefs()
);
} else {
@@ -986,7 +985,7 @@ class Plugin extends DAV\ServerPlugin {
*/
function report($reportName, $report) {
- switch($reportName) {
+ switch ($reportName) {
case '{DAV:}principal-property-search' :
$this->server->transactionType = 'report-principal-property-search';
@@ -1025,7 +1024,7 @@ class Plugin extends DAV\ServerPlugin {
$newAcl = $acl->getPrivileges();
// Normalizing urls
- foreach($newAcl as $k=>$newAce) {
+ foreach ($newAcl as $k => $newAce) {
$newAcl[$k]['principal'] = $this->server->calculateUri($newAce['principal']);
}
$node = $this->server->tree->getNodeForPath($path);
@@ -1040,12 +1039,12 @@ class Plugin extends DAV\ServerPlugin {
/* Checking if protected principals from the existing principal set are
not overwritten. */
- foreach($oldAcl as $oldAce) {
+ foreach ($oldAcl as $oldAce) {
if (!isset($oldAce['protected']) || !$oldAce['protected']) continue;
$found = false;
- foreach($newAcl as $newAce) {
+ foreach ($newAcl as $newAce) {
if (
$newAce['privilege'] === $oldAce['privilege'] &&
$newAce['principal'] === $oldAce['principal'] &&
@@ -1059,7 +1058,7 @@ class Plugin extends DAV\ServerPlugin {
}
- foreach($newAcl as $newAce) {
+ foreach ($newAcl as $newAce) {
// Do we recognize the privilege
if (!isset($supportedPrivileges[$newAce['privilege']])) {
@@ -1119,7 +1118,7 @@ class Plugin extends DAV\ServerPlugin {
'{DAV:}multistatus',
new DAV\Xml\Response\MultiStatus($result)
);
- $this->server->httpResponse->setHeader('Content-Type','application/xml; charset=utf-8');
+ $this->server->httpResponse->setHeader('Content-Type', 'application/xml; charset=utf-8');
$this->server->httpResponse->setStatus(207);
$this->server->httpResponse->setBody($xml);
@@ -1140,16 +1139,16 @@ class Plugin extends DAV\ServerPlugin {
$result = [];
- foreach($foundProperties as $node) {
+ foreach ($foundProperties as $node) {
- foreach($requestedProperties as $propertyName=>$childRequestedProperties) {
+ foreach ($requestedProperties as $propertyName => $childRequestedProperties) {
// We're only traversing if sub-properties were requested
- if(count($childRequestedProperties)===0) continue;
+ if (count($childRequestedProperties) === 0) continue;
// We only have to do the expansion if the property was found
// and it contains an href element.
- if (!array_key_exists($propertyName,$node[200])) continue;
+ if (!array_key_exists($propertyName, $node[200])) continue;
if (!$node[200][$propertyName] instanceof DAV\Xml\Property\Href) {
continue;
@@ -1158,10 +1157,10 @@ class Plugin extends DAV\ServerPlugin {
$childHrefs = $node[200][$propertyName]->getHrefs();
$childProps = [];
- foreach($childHrefs as $href) {
+ foreach ($childHrefs as $href) {
// Gathering the result of the children
$childProps[] = [
- 'name' => '{DAV:}response',
+ 'name' => '{DAV:}response',
'value' => $this->expandProperties($href, $childRequestedProperties, 0)[0]
];
}
@@ -1192,7 +1191,7 @@ class Plugin extends DAV\ServerPlugin {
protected function principalSearchPropertySetReport($report) {
$httpDepth = $this->server->getHTTPDepth(0);
- if ($httpDepth!==0) {
+ if ($httpDepth !== 0) {
throw new DAV\Exception\BadRequest('This report is only defined when Depth: 0');
}
@@ -1202,7 +1201,7 @@ class Plugin extends DAV\ServerPlugin {
$writer->startElement('{DAV:}principal-search-property-set');
- foreach($this->principalSearchPropertySet as $propertyName=>$description) {
+ foreach ($this->principalSearchPropertySet as $propertyName => $description) {
$writer->startElement('{DAV:}principal-search-property');
$writer->startElement('{DAV:}prop');
@@ -1213,8 +1212,8 @@ class Plugin extends DAV\ServerPlugin {
if ($description) {
$writer->write([[
- 'name' => '{DAV:}description',
- 'value' => $description,
+ 'name' => '{DAV:}description',
+ 'value' => $description,
'attributes' => ['xml:lang' => 'en']
]]);
}
@@ -1226,7 +1225,7 @@ class Plugin extends DAV\ServerPlugin {
$writer->endElement(); // principal-search-property-set
- $this->server->httpResponse->setHeader('Content-Type','application/xml; charset=utf-8');
+ $this->server->httpResponse->setHeader('Content-Type', 'application/xml; charset=utf-8');
$this->server->httpResponse->setStatus(200);
$this->server->httpResponse->setBody($writer->outputMemory());
@@ -1249,7 +1248,7 @@ class Plugin extends DAV\ServerPlugin {
if (!$report->applyToPrincipalCollectionSet) {
$uri = $this->server->httpRequest->getPath();
}
- if ($this->server->getHttpDepth('0')!==0) {
+ if ($this->server->getHttpDepth('0') !== 0) {
throw new BadRequest('Depth must be 0');
}
$result = $this->principalSearch(
@@ -1262,8 +1261,8 @@ class Plugin extends DAV\ServerPlugin {
$prefer = $this->server->getHTTPPRefer();
$this->server->httpResponse->setStatus(207);
- $this->server->httpResponse->setHeader('Content-Type','application/xml; charset=utf-8');
- $this->server->httpResponse->setHeader('Vary','Brief,Prefer');
+ $this->server->httpResponse->setHeader('Content-Type', 'application/xml; charset=utf-8');
+ $this->server->httpResponse->setHeader('Vary', 'Brief,Prefer');
$this->server->httpResponse->setBody($this->server->generateMultiStatus($result, $prefer['return-minimal']));
}
@@ -1284,7 +1283,7 @@ class Plugin extends DAV\ServerPlugin {
if (!$node instanceof PrincipalCollection)
return;
- $output.= '<tr><td colspan="2"><form method="post" action="">
+ $output .= '<tr><td colspan="2"><form method="post" action="">
<h3>Create new principal</h3>
<input type="hidden" name="sabreAction" value="mkcol" />
<input type="hidden" name="resourceType" value="{DAV:}principal" />
diff --git a/lib/DAVACL/Principal.php b/lib/DAVACL/Principal.php
index 80205fa..27f8679 100644
--- a/lib/DAVACL/Principal.php
+++ b/lib/DAVACL/Principal.php
@@ -169,7 +169,7 @@ class Principal extends DAV\Node implements IPrincipal, DAV\IProperties, IACL {
function getProperties($requestedProperties) {
$newProperties = [];
- foreach($requestedProperties as $propName) {
+ foreach ($requestedProperties as $propName) {
if (isset($this->principalProperties[$propName])) {
$newProperties[$propName] = $this->principalProperties[$propName];
diff --git a/lib/DAVACL/PrincipalBackend/AbstractBackend.php b/lib/DAVACL/PrincipalBackend/AbstractBackend.php
index 2437cda..5a28a28 100644
--- a/lib/DAVACL/PrincipalBackend/AbstractBackend.php
+++ b/lib/DAVACL/PrincipalBackend/AbstractBackend.php
@@ -36,12 +36,12 @@ abstract class AbstractBackend implements BackendInterface {
// Note that the default implementation here is a bit slow and could
// likely be optimized.
- if (substr($uri,0,7)!=='mailto:') {
+ if (substr($uri, 0, 7) !== 'mailto:') {
return;
}
$result = $this->searchPrincipals(
$principalPrefix,
- ['{http://sabredav.org/ns}email-address' => substr($uri,7)]
+ ['{http://sabredav.org/ns}email-address' => substr($uri, 7)]
);
if ($result) {
diff --git a/lib/DAVACL/PrincipalBackend/PDO.php b/lib/DAVACL/PrincipalBackend/PDO.php
index 61cf7bf..baf1118 100644
--- a/lib/DAVACL/PrincipalBackend/PDO.php
+++ b/lib/DAVACL/PrincipalBackend/PDO.php
@@ -2,11 +2,9 @@
namespace Sabre\DAVACL\PrincipalBackend;
-use
- Sabre\DAV,
- Sabre\DAV\MkCol,
- Sabre\DAVACL,
- Sabre\HTTP\URLUtil;
+use Sabre\DAV;
+use Sabre\DAV\MkCol;
+use Sabre\HTTP\URLUtil;
/**
* PDO principal backend
@@ -97,14 +95,14 @@ class PDO extends AbstractBackend implements CreatePrincipalSupport {
'uri',
];
- foreach($this->fieldMap as $key=>$value) {
+ foreach ($this->fieldMap as $key => $value) {
$fields[] = $value['dbField'];
}
- $result = $this->pdo->query('SELECT '.implode(',', $fields).' FROM '. $this->tableName);
+ $result = $this->pdo->query('SELECT ' . implode(',', $fields) . ' FROM ' . $this->tableName);
$principals = [];
- while($row = $result->fetch(\PDO::FETCH_ASSOC)) {
+ while ($row = $result->fetch(\PDO::FETCH_ASSOC)) {
// Checking if the principal is in the prefix
list($rowPrefix) = URLUtil::splitPath($row['uri']);
@@ -113,7 +111,7 @@ class PDO extends AbstractBackend implements CreatePrincipalSupport {
$principal = [
'uri' => $row['uri'],
];
- foreach($this->fieldMap as $key=>$value) {
+ foreach ($this->fieldMap as $key => $value) {
if ($row[$value['dbField']]) {
$principal[$key] = $row[$value['dbField']];
}
@@ -141,10 +139,10 @@ class PDO extends AbstractBackend implements CreatePrincipalSupport {
'uri',
];
- foreach($this->fieldMap as $key=>$value) {
+ foreach ($this->fieldMap as $key => $value) {
$fields[] = $value['dbField'];
}
- $stmt = $this->pdo->prepare('SELECT '.implode(',', $fields).' FROM '. $this->tableName . ' WHERE uri = ?');
+ $stmt = $this->pdo->prepare('SELECT ' . implode(',', $fields) . ' FROM ' . $this->tableName . ' WHERE uri = ?');
$stmt->execute([$path]);
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
@@ -154,7 +152,7 @@ class PDO extends AbstractBackend implements CreatePrincipalSupport {
'id' => $row['id'],
'uri' => $row['uri'],
];
- foreach($this->fieldMap as $key=>$value) {
+ foreach ($this->fieldMap as $key => $value) {
if ($row[$value['dbField']]) {
$principal[$key] = $row[$value['dbField']];
}
@@ -187,20 +185,20 @@ class PDO extends AbstractBackend implements CreatePrincipalSupport {
$values = [];
- foreach($properties as $key=>$value) {
+ foreach ($properties as $key => $value) {
$dbField = $this->fieldMap[$key]['dbField'];
if (!$first) {
- $query.= ', ';
+ $query .= ', ';
}
$first = false;
- $query.=$dbField . ' = :' . $dbField;
+ $query .= $dbField . ' = :' . $dbField;
$values[$dbField] = $value;
}
- $query.=" WHERE uri = :uri";
+ $query .= " WHERE uri = :uri";
$values['uri'] = $path;
$stmt = $this->pdo->prepare($query);
@@ -245,16 +243,16 @@ class PDO extends AbstractBackend implements CreatePrincipalSupport {
$query = 'SELECT uri FROM ' . $this->tableName . ' WHERE 1=1 ';
$values = [];
- foreach($searchProperties as $property => $value) {
+ foreach ($searchProperties as $property => $value) {
- switch($property) {
+ switch ($property) {
case '{DAV:}displayname' :
- $query.=' AND displayname LIKE ?';
+ $query .= ' AND displayname LIKE ?';
$values[] = '%' . $value . '%';
break;
case '{http://sabredav.org/ns}email-address' :
- $query.=' AND email LIKE ?';
+ $query .= ' AND email LIKE ?';
$values[] = '%' . $value . '%';
break;
default :
@@ -268,7 +266,7 @@ class PDO extends AbstractBackend implements CreatePrincipalSupport {
$stmt->execute($values);
$principals = [];
- while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
+ while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
// Checking if the principal is in the prefix
list($rowPrefix) = URLUtil::splitPath($row['uri']);
@@ -293,7 +291,7 @@ class PDO extends AbstractBackend implements CreatePrincipalSupport {
$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 = $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([$principal['id']]);
$result = [];
@@ -315,7 +313,7 @@ class PDO extends AbstractBackend implements CreatePrincipalSupport {
$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 = $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([$principal['id']]);
$result = [];
@@ -338,13 +336,13 @@ class PDO extends AbstractBackend implements CreatePrincipalSupport {
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 = $this->pdo->prepare('SELECT id, uri FROM ' . $this->tableName . ' WHERE uri IN (? ' . str_repeat(', ? ', count($members)) . ');');
$stmt->execute(array_merge([$principal], $members));
$memberIds = [];
$principalId = null;
- while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
+ while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
if ($row['uri'] == $principal) {
$principalId = $row['id'];
} else {
@@ -354,12 +352,12 @@ class PDO extends AbstractBackend implements CreatePrincipalSupport {
if (!$principalId) throw new DAV\Exception('Principal not found');
// Wiping out old members
- $stmt = $this->pdo->prepare('DELETE FROM '.$this->groupMembersTableName.' WHERE principal_id = ?;');
+ $stmt = $this->pdo->prepare('DELETE FROM ' . $this->groupMembersTableName . ' WHERE principal_id = ?;');
$stmt->execute([$principalId]);
- foreach($memberIds as $memberId) {
+ foreach ($memberIds as $memberId) {
- $stmt = $this->pdo->prepare('INSERT INTO '.$this->groupMembersTableName.' (principal_id, member_id) VALUES (?, ?);');
+ $stmt = $this->pdo->prepare('INSERT INTO ' . $this->groupMembersTableName . ' (principal_id, member_id) VALUES (?, ?);');
$stmt->execute([$principalId, $memberId]);
}
diff --git a/lib/DAVACL/PrincipalCollection.php b/lib/DAVACL/PrincipalCollection.php
index e034557..31ad50e 100644
--- a/lib/DAVACL/PrincipalCollection.php
+++ b/lib/DAVACL/PrincipalCollection.php
@@ -2,11 +2,10 @@
namespace Sabre\DAVACL;
-use
- Sabre\DAV\Exception\InvalidResourceType,
- Sabre\DAV\Exception\Forbidden,
- Sabre\DAV\IExtendedCollection,
- Sabre\DAV\MkCol;
+use Sabre\DAV\Exception\InvalidResourceType;
+use Sabre\DAV\Exception\Forbidden;
+use Sabre\DAV\IExtendedCollection;
+use Sabre\DAV\MkCol;
/**
* Principals Collection
diff --git a/lib/DAVACL/Xml/Property/Acl.php b/lib/DAVACL/Xml/Property/Acl.php
index 0f65292..76e2959 100644
--- a/lib/DAVACL/Xml/Property/Acl.php
+++ b/lib/DAVACL/Xml/Property/Acl.php
@@ -38,7 +38,7 @@ class Acl implements Element, HtmlOutput {
* Whether or not the server base url is required to be prefixed when
* serializing the property.
*
- * @var boolean
+ * @var bool
*/
protected $prefixBaseUrl;
@@ -98,7 +98,7 @@ class Acl implements Element, HtmlOutput {
*/
function xmlSerialize(Writer $writer) {
- foreach($this->privileges as $ace) {
+ foreach ($this->privileges as $ace) {
$this->serializeAce($writer, $ace);
@@ -125,7 +125,7 @@ class Acl implements Element, HtmlOutput {
ob_start();
echo "<table>";
echo "<tr><th>Principal</th><th>Privilege</th><th></th></tr>";
- foreach($this->privileges as $privilege) {
+ foreach ($this->privileges as $privilege) {
echo '<tr>';
// if it starts with a {, it's a special principal
@@ -177,9 +177,9 @@ class Acl implements Element, HtmlOutput {
$privileges = [];
- foreach((array)$reader->parseInnerTree($elementMap) as $element) {
+ foreach ((array)$reader->parseInnerTree($elementMap) as $element) {
- if ($element['name']!=='{DAV:}ace') {
+ if ($element['name'] !== '{DAV:}ace') {
continue;
}
$ace = $element['value'];
@@ -189,7 +189,7 @@ class Acl implements Element, HtmlOutput {
}
$principal = $ace['{DAV:}principal'];
- switch($principal->getType()) {
+ switch ($principal->getType()) {
case Principal::HREF :
$principal = $principal->getHref();
break;
@@ -210,12 +210,12 @@ class Acl implements Element, HtmlOutput {
if (!isset($ace['{DAV:}grant'])) {
throw new DAV\Exception\NotImplemented('Every {DAV:}ace element must have a {DAV:}grant element. {DAV:}deny is not yet supported');
}
- foreach($ace['{DAV:}grant'] as $elem) {
+ foreach ($ace['{DAV:}grant'] as $elem) {
if ($elem['name'] !== '{DAV:}privilege') {
continue;
}
- foreach($elem['value'] as $priv) {
+ foreach ($elem['value'] as $priv) {
$privileges[] = [
'principal' => $principal,
'protected' => $protected,
@@ -242,7 +242,7 @@ class Acl implements Element, HtmlOutput {
$writer->startElement('{DAV:}ace');
- switch($ace['principal']) {
+ switch ($ace['principal']) {
case '{DAV:}authenticated' :
$principal = new Principal(Principal::AUTHENTICATED);
break;
diff --git a/lib/DAVACL/Xml/Property/CurrentUserPrivilegeSet.php b/lib/DAVACL/Xml/Property/CurrentUserPrivilegeSet.php
index 9ab091c..7e4d792 100644
--- a/lib/DAVACL/Xml/Property/CurrentUserPrivilegeSet.php
+++ b/lib/DAVACL/Xml/Property/CurrentUserPrivilegeSet.php
@@ -61,7 +61,7 @@ class CurrentUserPrivilegeSet implements Element, HtmlOutput {
*/
function xmlSerialize(Writer $writer) {
- foreach($this->privileges as $privName) {
+ foreach ($this->privileges as $privName) {
$writer->startElement('{DAV:}privilege');
$writer->writeElement($privName);
@@ -121,7 +121,7 @@ class CurrentUserPrivilegeSet implements Element, HtmlOutput {
$result = [];
$tree = $reader->parseInnerTree(['{DAV:}privilege' => 'Sabre\\Xml\\Element\\Elements']);
- foreach($tree as $element) {
+ foreach ($tree as $element) {
if ($element['name'] !== '{DAV:}privilege') {
continue;
}
diff --git a/lib/DAVACL/Xml/Property/Principal.php b/lib/DAVACL/Xml/Property/Principal.php
index 33e90c9..2a5f5cf 100644
--- a/lib/DAVACL/Xml/Property/Principal.php
+++ b/lib/DAVACL/Xml/Property/Principal.php
@@ -61,11 +61,11 @@ class Principal extends DAV\Xml\Property\Href {
function __construct($type, $href = null) {
$this->type = $type;
- if ($type===self::HREF && is_null($href)) {
+ if ($type === self::HREF && is_null($href)) {
throw new DAV\Exception('The href argument must be specified for the HREF principal type.');
}
if ($href) {
- $href = rtrim($href,'/') . '/';
+ $href = rtrim($href, '/') . '/';
parent::__construct($href);
}
@@ -104,7 +104,7 @@ class Principal extends DAV\Xml\Property\Href {
*/
function xmlSerialize(Writer $writer) {
- switch($this->type) {
+ switch ($this->type) {
case self::UNAUTHENTICATED :
$writer->writeElement('{DAV:}unauthenticated');
@@ -147,7 +147,7 @@ class Principal extends DAV\Xml\Property\Href {
$tree = $reader->parseInnerTree()[0];
- switch($tree['name']) {
+ switch ($tree['name']) {
case '{DAV:}unauthenticated' :
return new self(self::UNAUTHENTICATED);
case '{DAV:}authenticated' :
diff --git a/lib/DAVACL/Xml/Property/SupportedPrivilegeSet.php b/lib/DAVACL/Xml/Property/SupportedPrivilegeSet.php
index 9fa4c32..9859506 100644
--- a/lib/DAVACL/Xml/Property/SupportedPrivilegeSet.php
+++ b/lib/DAVACL/Xml/Property/SupportedPrivilegeSet.php
@@ -104,7 +104,7 @@ class SupportedPrivilegeSet implements XmlSerializable, HtmlOutput {
}
if (isset($priv['aggregates'])) {
echo "\n<ul>\n";
- foreach($priv['aggregates'] as $subPriv) {
+ foreach ($priv['aggregates'] as $subPriv) {
$traverse($subPriv);
}
echo "</ul>";
@@ -132,7 +132,7 @@ class SupportedPrivilegeSet implements XmlSerializable, HtmlOutput {
* @param array $privilege
* @return void
*/
- private function serializePriv(Writer $writer,$privilege) {
+ private function serializePriv(Writer $writer, $privilege) {
$writer->startElement('{DAV:}supported-privilege');
@@ -147,7 +147,7 @@ class SupportedPrivilegeSet implements XmlSerializable, HtmlOutput {
$writer->writeElement('{DAV:}description', $privilege['description']);
}
if (isset($privilege['aggregates'])) {
- foreach($privilege['aggregates'] as $subPrivilege) {
+ foreach ($privilege['aggregates'] as $subPrivilege) {
$this->serializePriv($writer, $subPrivilege);
}
}
diff --git a/lib/DAVACL/Xml/Request/ExpandPropertyReport.php b/lib/DAVACL/Xml/Request/ExpandPropertyReport.php
index 36dab18..6d9a049 100644
--- a/lib/DAVACL/Xml/Request/ExpandPropertyReport.php
+++ b/lib/DAVACL/Xml/Request/ExpandPropertyReport.php
@@ -71,11 +71,11 @@ class ExpandPropertyReport implements XmlDeserializable {
* @param array $elems
* @return void
*/
- static private function traverse($elems) {
+ private static function traverse($elems) {
$result = [];
- foreach($elems as $elem) {
+ foreach ($elems as $elem) {
if ($elem['name'] !== '{DAV:}property') {
continue;
diff --git a/lib/DAVACL/Xml/Request/PrincipalPropertySearchReport.php b/lib/DAVACL/Xml/Request/PrincipalPropertySearchReport.php
index 06a3bd9..6394de1 100644
--- a/lib/DAVACL/Xml/Request/PrincipalPropertySearchReport.php
+++ b/lib/DAVACL/Xml/Request/PrincipalPropertySearchReport.php
@@ -48,8 +48,8 @@ class PrincipalPropertySearchReport implements XmlDeserializable {
* the properties (AND).
*
* This property is either "anyof" or "allof".
- *
- * @var string
+ *
+ * @var string
*/
public $test;
@@ -80,7 +80,7 @@ class PrincipalPropertySearchReport implements XmlDeserializable {
$foundSearchProp = false;
$self->test = 'allof';
- if ($reader->getAttribute('test')==='anyof') {
+ if ($reader->getAttribute('test') === 'anyof') {
$self->test = 'anyof';
}
@@ -89,9 +89,9 @@ class PrincipalPropertySearchReport implements XmlDeserializable {
'{DAV:}prop' => 'Sabre\\Xml\\Element\\KeyValue',
];
- foreach($reader->parseInnerTree($elemMap) as $elem) {
+ foreach ($reader->parseInnerTree($elemMap) as $elem) {
- switch($elem['name']) {
+ switch ($elem['name']) {
case '{DAV:}prop' :
$self->properties = array_keys($elem['value']);
@@ -105,7 +105,7 @@ class PrincipalPropertySearchReport implements XmlDeserializable {
if (!isset($elem['value']['{DAV:}prop']) || !isset($elem['value']['{DAV:}match'])) {
throw new BadRequest('The {DAV:}property-search element must contain one {DAV:}match and one {DAV:}prop element');
}
- foreach($elem['value']['{DAV:}prop'] as $propName=>$discard) {
+ foreach ($elem['value']['{DAV:}prop'] as $propName => $discard) {
$self->searchProperties[$propName] = $elem['value']['{DAV:}match'];
}
break;
--
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