Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Refactor ternary to elvis operator where possible #1561

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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