Skip to content

Commit c84cc78

Browse files
authored
Merge pull request #1561 from ChristophWurst/refactor/ternary-to-elvis
refactor: Refactor ternary to elvis operator where possible
2 parents efa1d9e + db953df commit c84cc78

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

lib/CalDAV/Backend/PDO.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ public function getCalendarsForUser($principalUri)
182182
'id' => [(int) $row['calendarid'], (int) $row['id']],
183183
'uri' => $row['uri'],
184184
'principaluri' => $row['principaluri'],
185-
'{'.CalDAV\Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'),
186-
'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
185+
'{'.CalDAV\Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ?: '0'),
186+
'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0',
187187
'{'.CalDAV\Plugin::NS_CALDAV.'}supported-calendar-component-set' => new CalDAV\Xml\Property\SupportedCalendarComponentSet($components),
188188
'{'.CalDAV\Plugin::NS_CALDAV.'}schedule-calendar-transp' => new CalDAV\Xml\Property\ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'),
189189
'share-resource-uri' => '/ns/share/'.$row['calendarid'],

lib/CardDAV/Backend/PDO.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function getAddressBooksForUser($principalUri)
7373
'{DAV:}displayname' => $row['displayname'],
7474
'{'.CardDAV\Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'],
7575
'{http://calendarserver.org/ns/}getctag' => $row['synctoken'],
76-
'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0',
76+
'{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0',
7777
];
7878
}
7979

lib/DAV/Browser/Plugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ public function escapeHTML($value)
258258
*/
259259
public function generateDirectoryIndex($path)
260260
{
261-
$html = $this->generateHeader($path ? $path : '/', $path);
261+
$html = $this->generateHeader($path ?: '/', $path);
262262

263263
$node = $this->server->tree->getNodeForPath($path);
264264
if ($node instanceof DAV\ICollection) {

lib/DAV/CorePlugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public function httpGet(RequestInterface $request, ResponseInterface $response)
154154
// Determining the exact byte offsets
155155
if (!is_null($range[0])) {
156156
$start = $range[0];
157-
$end = $range[1] ? $range[1] : $nodeSize - 1;
157+
$end = $range[1] ?: $nodeSize - 1;
158158
if ($start >= $nodeSize) {
159159
throw new Exception\RequestedRangeNotSatisfiable('The start offset ('.$range[0].') exceeded the size of the entity ('.$nodeSize.')');
160160
}

0 commit comments

Comments
 (0)