Skip to content

Commit

Permalink
Align createFile signatures with interface (#1422)
Browse files Browse the repository at this point in the history
$calendarData => $data
$vcardData => $data
$filename => $name

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
  • Loading branch information
kesselb committed Nov 8, 2023
1 parent 23bdabe commit 89384d4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions lib/CalDAV/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,17 +186,17 @@ public function createDirectory($name)
* The contents of the new file must be a valid ICalendar string.
*
* @param string $name
* @param resource $calendarData
* @param resource $data
*
* @return string|null
*/
public function createFile($name, $calendarData = null)
public function createFile($name, $data = null)
{
if (is_resource($calendarData)) {
$calendarData = stream_get_contents($calendarData);
if (is_resource($data)) {
$data = stream_get_contents($data);
}

return $this->caldavBackend->createCalendarObject($this->calendarInfo['id'], $name, $calendarData);
return $this->caldavBackend->createCalendarObject($this->calendarInfo['id'], $name, $data);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions lib/CalDAV/CalendarHome.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ public function getLastModified()
*
* This is currently not allowed
*
* @param string $filename
* @param string $name
* @param resource $data
*/
public function createFile($filename, $data = null)
public function createFile($name, $data = null)
{
throw new DAV\Exception\MethodNotAllowed('Creating new files in this collection is not supported');
}
Expand Down
12 changes: 6 additions & 6 deletions lib/CardDAV/AddressBook.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,19 +129,19 @@ public function createDirectory($name)
* This method may return an ETag.
*
* @param string $name
* @param resource $vcardData
* @param resource $data
*
* @return string|null
*/
public function createFile($name, $vcardData = null)
public function createFile($name, $data = null)
{
if (is_resource($vcardData)) {
$vcardData = stream_get_contents($vcardData);
if (is_resource($data)) {
$data = stream_get_contents($data);
}
// Converting to UTF-8, if needed
$vcardData = DAV\StringUtil::ensureUTF8($vcardData);
$data = DAV\StringUtil::ensureUTF8($data);

return $this->carddavBackend->createCard($this->addressBookInfo['id'], $name, $vcardData);
return $this->carddavBackend->createCard($this->addressBookInfo['id'], $name, $data);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions lib/CardDAV/AddressBookHome.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ public function getLastModified()
*
* This is currently not allowed
*
* @param string $filename
* @param string $name
* @param resource $data
*/
public function createFile($filename, $data = null)
public function createFile($name, $data = null)
{
throw new DAV\Exception\MethodNotAllowed('Creating new files in this collection is not supported');
}
Expand Down

0 comments on commit 89384d4

Please sign in to comment.