aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/dav/lib/CardDAV/Backend
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/sabre/dav/lib/CardDAV/Backend')
-rw-r--r--vendor/sabre/dav/lib/CardDAV/Backend/AbstractBackend.php17
-rw-r--r--vendor/sabre/dav/lib/CardDAV/Backend/BackendInterface.php57
-rw-r--r--vendor/sabre/dav/lib/CardDAV/Backend/PDO.php257
-rw-r--r--vendor/sabre/dav/lib/CardDAV/Backend/SyncSupport.php14
4 files changed, 174 insertions, 171 deletions
diff --git a/vendor/sabre/dav/lib/CardDAV/Backend/AbstractBackend.php b/vendor/sabre/dav/lib/CardDAV/Backend/AbstractBackend.php
index 03d2346da..6b041ade4 100644
--- a/vendor/sabre/dav/lib/CardDAV/Backend/AbstractBackend.php
+++ b/vendor/sabre/dav/lib/CardDAV/Backend/AbstractBackend.php
@@ -1,9 +1,11 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CardDAV\Backend;
/**
- * CardDAV abstract Backend
+ * CardDAV abstract Backend.
*
* This class serves as a base-class for addressbook backends
*
@@ -13,8 +15,8 @@ namespace Sabre\CardDAV\Backend;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-abstract class AbstractBackend implements BackendInterface {
-
+abstract class AbstractBackend implements BackendInterface
+{
/**
* Returns a list of cards.
*
@@ -25,14 +27,13 @@ abstract class AbstractBackend implements BackendInterface {
*
* @param mixed $addressBookId
* @param array $uris
+ *
* @return array
*/
- function getMultipleCards($addressBookId, array $uris) {
-
- return array_map(function($uri) use ($addressBookId) {
+ public function getMultipleCards($addressBookId, array $uris)
+ {
+ return array_map(function ($uri) use ($addressBookId) {
return $this->getCard($addressBookId, $uri);
}, $uris);
-
}
-
}
diff --git a/vendor/sabre/dav/lib/CardDAV/Backend/BackendInterface.php b/vendor/sabre/dav/lib/CardDAV/Backend/BackendInterface.php
index 18c0c0a99..804f09a36 100644
--- a/vendor/sabre/dav/lib/CardDAV/Backend/BackendInterface.php
+++ b/vendor/sabre/dav/lib/CardDAV/Backend/BackendInterface.php
@@ -1,9 +1,11 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CardDAV\Backend;
/**
- * CardDAV Backend Interface
+ * CardDAV Backend Interface.
*
* Any CardDAV backend must implement this interface.
*
@@ -15,8 +17,8 @@ namespace Sabre\CardDAV\Backend;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-interface BackendInterface {
-
+interface BackendInterface
+{
/**
* Returns the list of addressbooks for a specific user.
*
@@ -32,9 +34,10 @@ interface BackendInterface {
* {http://calendarserver.org/ns/}getctag
*
* @param string $principalUri
+ *
* @return array
*/
- function getAddressBooksForUser($principalUri);
+ public function getAddressBooksForUser($principalUri);
/**
* Updates properties for an address book.
@@ -48,11 +51,10 @@ interface BackendInterface {
*
* Read the PropPatch documentation for more info and examples.
*
- * @param string $addressBookId
+ * @param string $addressBookId
* @param \Sabre\DAV\PropPatch $propPatch
- * @return void
*/
- function updateAddressBook($addressBookId, \Sabre\DAV\PropPatch $propPatch);
+ public function updateAddressBook($addressBookId, \Sabre\DAV\PropPatch $propPatch);
/**
* Creates a new address book.
@@ -61,19 +63,19 @@ interface BackendInterface {
* in any format, including ints, strings, arrays or objects.
*
* @param string $principalUri
- * @param string $url Just the 'basename' of the url.
- * @param array $properties
+ * @param string $url just the 'basename' of the url
+ * @param array $properties
+ *
* @return mixed
*/
- function createAddressBook($principalUri, $url, array $properties);
+ public function createAddressBook($principalUri, $url, array $properties);
/**
- * Deletes an entire addressbook and all its contents
+ * Deletes an entire addressbook and all its contents.
*
* @param mixed $addressBookId
- * @return void
*/
- function deleteAddressBook($addressBookId);
+ public function deleteAddressBook($addressBookId);
/**
* Returns all cards for a specific addressbook id.
@@ -92,9 +94,10 @@ interface BackendInterface {
* This may speed up certain requests, especially with large cards.
*
* @param mixed $addressbookId
+ *
* @return array
*/
- function getCards($addressbookId);
+ public function getCards($addressbookId);
/**
* Returns a specfic card.
@@ -104,11 +107,12 @@ interface BackendInterface {
*
* If the card does not exist, you must return false.
*
- * @param mixed $addressBookId
+ * @param mixed $addressBookId
* @param string $cardUri
+ *
* @return array
*/
- function getCard($addressBookId, $cardUri);
+ public function getCard($addressBookId, $cardUri);
/**
* Returns a list of cards.
@@ -120,9 +124,10 @@ interface BackendInterface {
*
* @param mixed $addressBookId
* @param array $uris
+ *
* @return array
*/
- function getMultipleCards($addressBookId, array $uris);
+ public function getMultipleCards($addressBookId, array $uris);
/**
* Creates a new card.
@@ -144,12 +149,13 @@ interface BackendInterface {
*
* If you don't return an ETag, you can just return null.
*
- * @param mixed $addressBookId
+ * @param mixed $addressBookId
* @param string $cardUri
* @param string $cardData
+ *
* @return string|null
*/
- function createCard($addressBookId, $cardUri, $cardData);
+ public function createCard($addressBookId, $cardUri, $cardData);
/**
* Updates a card.
@@ -171,20 +177,21 @@ interface BackendInterface {
*
* If you don't return an ETag, you can just return null.
*
- * @param mixed $addressBookId
+ * @param mixed $addressBookId
* @param string $cardUri
* @param string $cardData
+ *
* @return string|null
*/
- function updateCard($addressBookId, $cardUri, $cardData);
+ public function updateCard($addressBookId, $cardUri, $cardData);
/**
- * Deletes a card
+ * Deletes a card.
*
- * @param mixed $addressBookId
+ * @param mixed $addressBookId
* @param string $cardUri
+ *
* @return bool
*/
- function deleteCard($addressBookId, $cardUri);
-
+ public function deleteCard($addressBookId, $cardUri);
}
diff --git a/vendor/sabre/dav/lib/CardDAV/Backend/PDO.php b/vendor/sabre/dav/lib/CardDAV/Backend/PDO.php
index 13487e9da..0659455e5 100644
--- a/vendor/sabre/dav/lib/CardDAV/Backend/PDO.php
+++ b/vendor/sabre/dav/lib/CardDAV/Backend/PDO.php
@@ -1,12 +1,14 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CardDAV\Backend;
use Sabre\CardDAV;
use Sabre\DAV;
/**
- * PDO CardDAV backend
+ * PDO CardDAV backend.
*
* This CardDAV backend uses PDO to store addressbooks
*
@@ -14,22 +16,22 @@ use Sabre\DAV;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-class PDO extends AbstractBackend implements SyncSupport {
-
+class PDO extends AbstractBackend implements SyncSupport
+{
/**
- * PDO connection
+ * PDO connection.
*
* @var PDO
*/
protected $pdo;
/**
- * The PDO table name used to store addressbooks
+ * The PDO table name used to store addressbooks.
*/
public $addressBooksTableName = 'addressbooks';
/**
- * The PDO table name used to store cards
+ * The PDO table name used to store cards.
*/
public $cardsTableName = 'cards';
@@ -41,48 +43,44 @@ class PDO extends AbstractBackend implements SyncSupport {
public $addressBookChangesTableName = 'addressbookchanges';
/**
- * Sets up the object
+ * Sets up the object.
*
* @param \PDO $pdo
*/
- function __construct(\PDO $pdo) {
-
+ public function __construct(\PDO $pdo)
+ {
$this->pdo = $pdo;
-
}
/**
* Returns the list of addressbooks for a specific user.
*
* @param string $principalUri
+ *
* @return array
*/
- function getAddressBooksForUser($principalUri) {
-
- $stmt = $this->pdo->prepare('SELECT id, uri, displayname, principaluri, description, synctoken FROM ' . $this->addressBooksTableName . ' WHERE principaluri = ?');
+ public function getAddressBooksForUser($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) {
-
$addressBooks[] = [
- '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',
+ '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',
];
-
}
return $addressBooks;
-
}
-
/**
* Updates properties for an address book.
*
@@ -95,32 +93,29 @@ class PDO extends AbstractBackend implements SyncSupport {
*
* Read the PropPatch documentation for more info and examples.
*
- * @param string $addressBookId
+ * @param string $addressBookId
* @param \Sabre\DAV\PropPatch $propPatch
- * @return void
*/
- function updateAddressBook($addressBookId, \Sabre\DAV\PropPatch $propPatch) {
-
+ public function updateAddressBook($addressBookId, \Sabre\DAV\PropPatch $propPatch)
+ {
$supportedProperties = [
'{DAV:}displayname',
- '{' . CardDAV\Plugin::NS_CARDDAV . '}addressbook-description',
+ '{'.CardDAV\Plugin::NS_CARDDAV.'}addressbook-description',
];
- $propPatch->handle($supportedProperties, function($mutations) use ($addressBookId) {
-
+ $propPatch->handle($supportedProperties, function ($mutations) use ($addressBookId) {
$updates = [];
foreach ($mutations as $property => $newValue) {
-
switch ($property) {
- case '{DAV:}displayname' :
+ case '{DAV:}displayname':
$updates['displayname'] = $newValue;
break;
- case '{' . CardDAV\Plugin::NS_CARDDAV . '}addressbook-description' :
+ case '{'.CardDAV\Plugin::NS_CARDDAV.'}addressbook-description':
$updates['description'] = $newValue;
break;
}
}
- $query = 'UPDATE ' . $this->addressBooksTableName . ' SET ';
+ $query = 'UPDATE '.$this->addressBooksTableName.' SET ';
$first = true;
foreach ($updates as $key => $value) {
if ($first) {
@@ -128,7 +123,7 @@ class PDO extends AbstractBackend implements SyncSupport {
} else {
$query .= ', ';
}
- $query .= ' ' . $key . ' = :' . $key . ' ';
+ $query .= ' '.$key.' = :'.$key.' ';
}
$query .= ' WHERE id = :addressbookid';
@@ -137,72 +132,67 @@ class PDO extends AbstractBackend implements SyncSupport {
$stmt->execute($updates);
- $this->addChange($addressBookId, "", 2);
+ $this->addChange($addressBookId, '', 2);
return true;
-
});
-
}
/**
- * Creates a new address book
+ * Creates a new address book.
*
* @param string $principalUri
- * @param string $url Just the 'basename' of the url.
- * @param array $properties
+ * @param string $url just the 'basename' of the url
+ * @param array $properties
+ *
* @return int Last insert id
*/
- function createAddressBook($principalUri, $url, array $properties) {
-
+ public 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) {
-
switch ($property) {
- case '{DAV:}displayname' :
+ case '{DAV:}displayname':
$values['displayname'] = $newValue;
break;
- case '{' . CardDAV\Plugin::NS_CARDDAV . '}addressbook-description' :
+ case '{'.CardDAV\Plugin::NS_CARDDAV.'}addressbook-description':
$values['description'] = $newValue;
break;
- default :
- throw new DAV\Exception\BadRequest('Unknown property: ' . $property);
+ default:
+ throw new DAV\Exception\BadRequest('Unknown property: '.$property);
}
-
}
- $query = 'INSERT INTO ' . $this->addressBooksTableName . ' (uri, displayname, description, principaluri, synctoken) VALUES (:uri, :displayname, :description, :principaluri, 1)';
+ $query = 'INSERT INTO '.$this->addressBooksTableName.' (uri, displayname, description, principaluri, synctoken) VALUES (:uri, :displayname, :description, :principaluri, 1)';
$stmt = $this->pdo->prepare($query);
$stmt->execute($values);
+
return $this->pdo->lastInsertId(
- $this->addressBooksTableName . '_id_seq'
+ $this->addressBooksTableName.'_id_seq'
);
-
}
/**
- * Deletes an entire addressbook and all its contents
+ * Deletes an entire addressbook and all its contents.
*
* @param int $addressBookId
- * @return void
*/
- function deleteAddressBook($addressBookId) {
-
- $stmt = $this->pdo->prepare('DELETE FROM ' . $this->cardsTableName . ' WHERE addressbookid = ?');
+ public function deleteAddressBook($addressBookId)
+ {
+ $stmt = $this->pdo->prepare('DELETE FROM '.$this->cardsTableName.' WHERE addressbookid = ?');
$stmt->execute([$addressBookId]);
- $stmt = $this->pdo->prepare('DELETE FROM ' . $this->addressBooksTableName . ' WHERE id = ?');
+ $stmt = $this->pdo->prepare('DELETE FROM '.$this->addressBooksTableName.' WHERE id = ?');
$stmt->execute([$addressBookId]);
- $stmt = $this->pdo->prepare('DELETE FROM ' . $this->addressBookChangesTableName . ' WHERE addressbookid = ?');
+ $stmt = $this->pdo->prepare('DELETE FROM '.$this->addressBookChangesTableName.' WHERE addressbookid = ?');
$stmt->execute([$addressBookId]);
-
}
/**
@@ -222,21 +212,22 @@ class PDO extends AbstractBackend implements SyncSupport {
* This may speed up certain requests, especially with large cards.
*
* @param mixed $addressbookId
+ *
* @return array
*/
- function getCards($addressbookId) {
-
- $stmt = $this->pdo->prepare('SELECT id, uri, lastmodified, etag, size FROM ' . $this->cardsTableName . ' WHERE addressbookid = ?');
+ public function getCards($addressbookId)
+ {
+ $stmt = $this->pdo->prepare('SELECT id, uri, lastmodified, etag, size FROM '.$this->cardsTableName.' WHERE addressbookid = ?');
$stmt->execute([$addressbookId]);
$result = [];
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
- $row['etag'] = '"' . $row['etag'] . '"';
- $row['lastmodified'] = (int)$row['lastmodified'];
+ $row['etag'] = '"'.$row['etag'].'"';
+ $row['lastmodified'] = (int) $row['lastmodified'];
$result[] = $row;
}
- return $result;
+ return $result;
}
/**
@@ -247,23 +238,26 @@ class PDO extends AbstractBackend implements SyncSupport {
*
* If the card does not exist, you must return false.
*
- * @param mixed $addressBookId
+ * @param mixed $addressBookId
* @param string $cardUri
+ *
* @return array
*/
- function getCard($addressBookId, $cardUri) {
-
- $stmt = $this->pdo->prepare('SELECT id, carddata, uri, lastmodified, etag, size FROM ' . $this->cardsTableName . ' WHERE addressbookid = ? AND uri = ? LIMIT 1');
+ public function getCard($addressBookId, $cardUri)
+ {
+ $stmt = $this->pdo->prepare('SELECT id, carddata, uri, lastmodified, etag, size FROM '.$this->cardsTableName.' WHERE addressbookid = ? AND uri = ? LIMIT 1');
$stmt->execute([$addressBookId, $cardUri]);
$result = $stmt->fetch(\PDO::FETCH_ASSOC);
- if (!$result) return false;
+ if (!$result) {
+ return false;
+ }
+
+ $result['etag'] = '"'.$result['etag'].'"';
+ $result['lastmodified'] = (int) $result['lastmodified'];
- $result['etag'] = '"' . $result['etag'] . '"';
- $result['lastmodified'] = (int)$result['lastmodified'];
return $result;
-
}
/**
@@ -276,11 +270,12 @@ class PDO extends AbstractBackend implements SyncSupport {
*
* @param mixed $addressBookId
* @param array $uris
+ *
* @return array
*/
- function getMultipleCards($addressBookId, array $uris) {
-
- $query = 'SELECT id, uri, lastmodified, etag, size, carddata FROM ' . $this->cardsTableName . ' WHERE addressbookid = ? AND uri IN (';
+ public function getMultipleCards($addressBookId, array $uris)
+ {
+ $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 .= ')';
@@ -289,12 +284,12 @@ class PDO extends AbstractBackend implements SyncSupport {
$stmt->execute(array_merge([$addressBookId], $uris));
$result = [];
while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
- $row['etag'] = '"' . $row['etag'] . '"';
- $row['lastmodified'] = (int)$row['lastmodified'];
+ $row['etag'] = '"'.$row['etag'].'"';
+ $row['lastmodified'] = (int) $row['lastmodified'];
$result[] = $row;
}
- return $result;
+ return $result;
}
/**
@@ -317,14 +312,15 @@ class PDO extends AbstractBackend implements SyncSupport {
*
* If you don't return an ETag, you can just return null.
*
- * @param mixed $addressBookId
+ * @param mixed $addressBookId
* @param string $cardUri
* @param string $cardData
+ *
* @return string|null
*/
- function createCard($addressBookId, $cardUri, $cardData) {
-
- $stmt = $this->pdo->prepare('INSERT INTO ' . $this->cardsTableName . ' (carddata, uri, lastmodified, addressbookid, size, etag) VALUES (?, ?, ?, ?, ?, ?)');
+ public function createCard($addressBookId, $cardUri, $cardData)
+ {
+ $stmt = $this->pdo->prepare('INSERT INTO '.$this->cardsTableName.' (carddata, uri, lastmodified, addressbookid, size, etag) VALUES (?, ?, ?, ?, ?, ?)');
$etag = md5($cardData);
@@ -339,8 +335,7 @@ class PDO extends AbstractBackend implements SyncSupport {
$this->addChange($addressBookId, $cardUri, 1);
- return '"' . $etag . '"';
-
+ return '"'.$etag.'"';
}
/**
@@ -363,14 +358,15 @@ class PDO extends AbstractBackend implements SyncSupport {
*
* If you don't return an ETag, you can just return null.
*
- * @param mixed $addressBookId
+ * @param mixed $addressBookId
* @param string $cardUri
* @param string $cardData
+ *
* @return string|null
*/
- function updateCard($addressBookId, $cardUri, $cardData) {
-
- $stmt = $this->pdo->prepare('UPDATE ' . $this->cardsTableName . ' SET carddata = ?, lastmodified = ?, size = ?, etag = ? WHERE uri = ? AND addressbookid =?');
+ public function updateCard($addressBookId, $cardUri, $cardData)
+ {
+ $stmt = $this->pdo->prepare('UPDATE '.$this->cardsTableName.' SET carddata = ?, lastmodified = ?, size = ?, etag = ? WHERE uri = ? AND addressbookid =?');
$etag = md5($cardData);
$stmt->execute([
@@ -379,31 +375,30 @@ class PDO extends AbstractBackend implements SyncSupport {
strlen($cardData),
$etag,
$cardUri,
- $addressBookId
+ $addressBookId,
]);
$this->addChange($addressBookId, $cardUri, 2);
- return '"' . $etag . '"';
-
+ return '"'.$etag.'"';
}
/**
- * Deletes a card
+ * Deletes a card.
*
- * @param mixed $addressBookId
+ * @param mixed $addressBookId
* @param string $cardUri
+ *
* @return bool
*/
- function deleteCard($addressBookId, $cardUri) {
-
- $stmt = $this->pdo->prepare('DELETE FROM ' . $this->cardsTableName . ' WHERE addressbookid = ? AND uri = ?');
+ public function deleteCard($addressBookId, $cardUri)
+ {
+ $stmt = $this->pdo->prepare('DELETE FROM '.$this->cardsTableName.' WHERE addressbookid = ? AND uri = ?');
$stmt->execute([$addressBookId, $cardUri]);
$this->addChange($addressBookId, $cardUri, 3);
- return $stmt->rowCount() === 1;
-
+ return 1 === $stmt->rowCount();
}
/**
@@ -458,30 +453,34 @@ class PDO extends AbstractBackend implements SyncSupport {
*
* @param string $addressBookId
* @param string $syncToken
- * @param int $syncLevel
- * @param int $limit
+ * @param int $syncLevel
+ * @param int $limit
+ *
* @return array
*/
- function getChangesForAddressBook($addressBookId, $syncToken, $syncLevel, $limit = null) {
-
+ public function getChangesForAddressBook($addressBookId, $syncToken, $syncLevel, $limit = null)
+ {
// Current synctoken
- $stmt = $this->pdo->prepare('SELECT synctoken FROM ' . $this->addressBooksTableName . ' WHERE id = ?');
+ $stmt = $this->pdo->prepare('SELECT synctoken FROM '.$this->addressBooksTableName.' WHERE id = ?');
$stmt->execute([$addressBookId]);
$currentToken = $stmt->fetchColumn(0);
- if (is_null($currentToken)) return null;
+ if (is_null($currentToken)) {
+ return null;
+ }
$result = [
'syncToken' => $currentToken,
- 'added' => [],
- 'modified' => [],
- 'deleted' => [],
+ 'added' => [],
+ 'modified' => [],
+ 'deleted' => [],
];
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;
+ $query = 'SELECT uri, operation FROM '.$this->addressBookChangesTableName.' WHERE synctoken >= ? AND synctoken < ? AND addressbookid = ? ORDER BY synctoken';
+ if ($limit > 0) {
+ $query .= ' LIMIT '.(int) $limit;
+ }
// Fetching all changes
$stmt = $this->pdo->prepare($query);
@@ -492,13 +491,10 @@ 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)) {
-
$changes[$row['uri']] = $row['operation'];
-
}
foreach ($changes as $uri => $operation) {
-
switch ($operation) {
case 1:
$result['added'][] = $uri;
@@ -510,41 +506,38 @@ class PDO extends AbstractBackend implements SyncSupport {
$result['deleted'][] = $uri;
break;
}
-
}
} else {
// No synctoken supplied, this is the initial sync.
- $query = "SELECT uri FROM " . $this->cardsTableName . " WHERE addressbookid = ?";
+ $query = 'SELECT uri FROM '.$this->cardsTableName.' WHERE addressbookid = ?';
$stmt = $this->pdo->prepare($query);
$stmt->execute([$addressBookId]);
$result['added'] = $stmt->fetchAll(\PDO::FETCH_COLUMN);
}
- return $result;
+ return $result;
}
/**
* Adds a change record to the addressbookchanges table.
*
- * @param mixed $addressBookId
+ * @param mixed $addressBookId
* @param string $objectUri
- * @param int $operation 1 = add, 2 = modify, 3 = delete
- * @return void
+ * @param int $operation 1 = add, 2 = modify, 3 = delete
*/
- 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 = ?');
+ 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->execute([
$objectUri,
$addressBookId,
$operation,
- $addressBookId
+ $addressBookId,
]);
- $stmt = $this->pdo->prepare('UPDATE ' . $this->addressBooksTableName . ' SET synctoken = synctoken + 1 WHERE id = ?');
+ $stmt = $this->pdo->prepare('UPDATE '.$this->addressBooksTableName.' SET synctoken = synctoken + 1 WHERE id = ?');
$stmt->execute([
- $addressBookId
+ $addressBookId,
]);
-
}
}
diff --git a/vendor/sabre/dav/lib/CardDAV/Backend/SyncSupport.php b/vendor/sabre/dav/lib/CardDAV/Backend/SyncSupport.php
index f80618a8e..071361ed0 100644
--- a/vendor/sabre/dav/lib/CardDAV/Backend/SyncSupport.php
+++ b/vendor/sabre/dav/lib/CardDAV/Backend/SyncSupport.php
@@ -1,5 +1,7 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\CardDAV\Backend;
/**
@@ -18,8 +20,8 @@ namespace Sabre\CardDAV\Backend;
* @author Evert Pot (http://evertpot.com/)
* @license http://sabre.io/license/ Modified BSD License
*/
-interface SyncSupport extends BackendInterface {
-
+interface SyncSupport extends BackendInterface
+{
/**
* The getChanges method returns all the changes that have happened, since
* the specified syncToken in the specified address book.
@@ -72,10 +74,10 @@ interface SyncSupport extends BackendInterface {
*
* @param string $addressBookId
* @param string $syncToken
- * @param int $syncLevel
- * @param int $limit
+ * @param int $syncLevel
+ * @param int $limit
+ *
* @return array
*/
- function getChangesForAddressBook($addressBookId, $syncToken, $syncLevel, $limit = null);
-
+ public function getChangesForAddressBook($addressBookId, $syncToken, $syncLevel, $limit = null);
}