$boundaryValue = trim($boundaryValue);
// Remove potential quotes around boundary value.
- if (substr($boundaryValue, 0, 1) === '"' && substr($boundaryValue, -1) === '"') {
+ if (str_starts_with($boundaryValue, '"') && str_ends_with($boundaryValue, '"')) {
$boundaryValue = substr($boundaryValue, 1, -1);
}
* @return string|null
*/
private function principalToUserId(string $userPrincipal):?string {
- if (substr($userPrincipal, 0, 17) === 'principals/users/') {
+ if (str_starts_with($userPrincipal, 'principals/users/')) {
return substr($userPrincipal, 17);
}
return null;
if (isset($fileCondition['tokens'])) {
foreach ($fileCondition['tokens'] as &$token) {
if (isset($token['token'])) {
- if (substr($token['token'], 0, 16) === 'opaquelocktoken:') {
+ if (str_starts_with($token['token'], 'opaquelocktoken:')) {
$token['validToken'] = true;
}
}
$mountpoint = $this->info->getMountPoint();
if (!($mountpoint instanceof MoveableMount)) {
$mountpointpath = $mountpoint->getMountPoint();
- if (substr($mountpointpath, -1) === '/') {
+ if (str_ends_with($mountpointpath, '/')) {
$mountpointpath = substr($mountpointpath, 0, -1);
}
return $this->principalPrefix . '/' . $user->getUID();
}
}
- if (substr($uri, 0, 10) === 'principal:') {
+ if (str_starts_with($uri, 'principal:')) {
$principal = substr($uri, 10);
$principal = $this->getPrincipalByPath($principal);
if ($principal !== null) {
// substr of calendars/ => path is inside the CalDAV component
// two '/' => this a calendar (no calendar-home nor calendar object)
- if (substr($path, 0, 10) === 'calendars/' && substr_count($path, '/') === 2) {
+ if (str_starts_with($path, 'calendars/') && substr_count($path, '/') === 2) {
$allRequestedProps = $propFind->getRequestedProperties();
$customPropertiesForShares = [
'{DAV:}displayname',
$realPath = $storage->getSourcePath($internalPath);
$dh = opendir($realPath);
while (($file = readdir($dh)) !== false) {
- if (substr($file, strlen($file) - 5, 5) === '.part') {
+ if (str_ends_with($file, '.part')) {
$files[] = $file;
}
}