Skip to content

Commit

Permalink
Merge pull request #1561 from ChristophWurst/refactor/ternary-to-elvis
Browse files Browse the repository at this point in the history
refactor: Refactor ternary to elvis operator where possible
  • Loading branch information
phil-davis authored Nov 5, 2024
2 parents efa1d9e + db953df commit c84cc78
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/CalDAV/Backend/PDO.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ public function getCalendarsForUser($principalUri)
'id' => [(int) $row['calendarid'], (int) $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_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ?: '0'),
'{http://sabredav.org/ns}sync-token' => $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'),
'share-resource-uri' => '/ns/share/'.$row['calendarid'],
Expand Down
2 changes: 1 addition & 1 deletion lib/CardDAV/Backend/PDO.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function getAddressBooksForUser($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://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0',
];
}

Expand Down
2 changes: 1 addition & 1 deletion lib/DAV/Browser/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ public function escapeHTML($value)
*/
public function generateDirectoryIndex($path)
{
$html = $this->generateHeader($path ? $path : '/', $path);
$html = $this->generateHeader($path ?: '/', $path);

$node = $this->server->tree->getNodeForPath($path);
if ($node instanceof DAV\ICollection) {
Expand Down
2 changes: 1 addition & 1 deletion lib/DAV/CorePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public function httpGet(RequestInterface $request, ResponseInterface $response)
// Determining the exact byte offsets
if (!is_null($range[0])) {
$start = $range[0];
$end = $range[1] ? $range[1] : $nodeSize - 1;
$end = $range[1] ?: $nodeSize - 1;
if ($start >= $nodeSize) {
throw new Exception\RequestedRangeNotSatisfiable('The start offset ('.$range[0].') exceeded the size of the entity ('.$nodeSize.')');
}
Expand Down

0 comments on commit c84cc78

Please sign in to comment.