diff options
author | Robin Appelman <robin@icewind.nl> | 2023-06-01 23:10:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-01 23:10:00 +0200 |
commit | 9f1d497a0b4dbda86e676a3a55758bc2909cc781 (patch) | |
tree | 968db9431470d4d0e1ea7c80caed373fc9029120 /lib/private/AppFramework/App.php | |
parent | e81fdfefab6d46b9d326b70c278d52fbb941a431 (diff) | |
parent | fa31c707c0a4c2a72141b8017e66561710185a06 (diff) | |
download | nextcloud-server-9f1d497a0b4dbda86e676a3a55758bc2909cc781.tar.gz nextcloud-server-9f1d497a0b4dbda86e676a3a55758bc2909cc781.zip |
Merge pull request #38261 from fsamapoor/replace_strpos_calls_in_lib_private
Refactors "strpos" calls in lib/private to improve code readability.
Diffstat (limited to 'lib/private/AppFramework/App.php')
-rw-r--r-- | lib/private/AppFramework/App.php | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/private/AppFramework/App.php b/lib/private/AppFramework/App.php index b2f14b8dde4..ffd77da888e 100644 --- a/lib/private/AppFramework/App.php +++ b/lib/private/AppFramework/App.php @@ -92,12 +92,12 @@ class App { } public static function getAppIdForClass(string $className, string $topNamespace = 'OCA\\'): ?string { - if (strpos($className, $topNamespace) !== 0) { + if (!str_starts_with($className, $topNamespace)) { return null; } foreach (self::$nameSpaceCache as $appId => $namespace) { - if (strpos($className, $topNamespace . $namespace . '\\') === 0) { + if (str_starts_with($className, $topNamespace . $namespace . '\\')) { return $appId; } } @@ -148,7 +148,7 @@ class App { try { $controller = $container->get($controllerName); } catch (QueryException $e) { - if (strpos($controllerName, '\\Controller\\') !== false) { + if (str_contains($controllerName, '\\Controller\\')) { // This is from a global registered app route that is not enabled. [/*OC(A)*/, $app, /* Controller/Name*/] = explode('\\', $controllerName, 3); throw new HintException('App ' . strtolower($app) . ' is not enabled'); |