aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Files/Node
diff options
context:
space:
mode:
authorFaraz Samapoor <fsamapoor@gmail.com>2023-05-15 15:17:19 +0330
committerFaraz Samapoor <fsamapoor@gmail.com>2023-05-15 15:17:19 +0330
commite7cc7653b885c49b1b3f0a78f91ea05a53e102d8 (patch)
tree42da61d5c6e988d7c9eff7e081327a73f661dc89 /lib/private/Files/Node
parent8bdb50fd507bfe68161ab98eba903872083ea4f3 (diff)
downloadnextcloud-server-e7cc7653b885c49b1b3f0a78f91ea05a53e102d8.tar.gz
nextcloud-server-e7cc7653b885c49b1b3f0a78f91ea05a53e102d8.zip
Refactors "strpos" calls in lib/private to improve code readability.
Signed-off-by: Faraz Samapoor <fsamapoor@gmail.com>
Diffstat (limited to 'lib/private/Files/Node')
-rw-r--r--lib/private/Files/Node/Folder.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/private/Files/Node/Folder.php b/lib/private/Files/Node/Folder.php
index 1d6d88bafe6..44f47e92ca0 100644
--- a/lib/private/Files/Node/Folder.php
+++ b/lib/private/Files/Node/Folder.php
@@ -88,7 +88,7 @@ class Folder extends Node implements \OCP\Files\Folder {
* @return bool
*/
public function isSubNode($node) {
- return strpos($node->getPath(), $this->path . '/') === 0;
+ return str_starts_with($node->getPath(), $this->path . '/');
}
/**
@@ -284,7 +284,7 @@ class Folder extends Node implements \OCP\Files\Folder {
* @return Node[]
*/
public function searchByMime($mimetype) {
- if (strpos($mimetype, '/') === false) {
+ if (!str_contains($mimetype, '/')) {
$query = $this->queryFromOperator(new SearchComparison(ISearchComparison::COMPARE_LIKE, 'mimetype', $mimetype . '/%'));
} else {
$query = $this->queryFromOperator(new SearchComparison(ISearchComparison::COMPARE_EQUAL, 'mimetype', $mimetype));
@@ -339,7 +339,7 @@ class Folder extends Node implements \OCP\Files\Folder {
$absolutePath = '/' . ltrim($cacheEntry->getPath(), '/');
$currentPath = rtrim($this->path, '/') . '/';
- if (strpos($absolutePath, $currentPath) !== 0) {
+ if (!str_starts_with($absolutePath, $currentPath)) {
return [];
}