Comparing stringlength is cheaper than strpos

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
Roeland Jago Douma 2018-03-26 16:48:20 +02:00
parent e48d4c4aad
commit dc222aa3a5
No known key found for this signature in database
GPG Key ID: F941078878347C0C
1 changed files with 1 additions and 1 deletions

View File

@ -81,7 +81,7 @@ class Manager implements IMountManager {
$mountPoints = array_keys($this->mounts);
$foundMountPointLength = 0;
foreach ($mountPoints as $mountpoint) {
if (strpos($path, $mountpoint) === 0 && \strlen($mountpoint) > $foundMountPointLength) {
if (\strlen($mountpoint) > $foundMountPointLength && strpos($path, $mountpoint) === 0) {
$foundMountPoint = $mountpoint;
$foundMountPointLength = \strlen($foundMountPoint);
}