Code Duplication    Length = 6-6 lines in 4 locations

src/Path.php 4 locations

@@ 203-208 (lines=6) @@
200
        $path = static::canonicalize($path);
201
202
        // Maintain scheme
203
        if (false !== ($pos = strpos($path, '://'))) {
204
            $scheme = substr($path, 0, $pos + 3);
205
            $path = substr($path, $pos + 3);
206
        } else {
207
            $scheme = '';
208
        }
209
210
        if (false !== ($pos = strrpos($path, '/'))) {
211
            // Directory equals root directory "/"
@@ 286-291 (lines=6) @@
283
        Assert::string($path, 'The path must be a string. Got: %s');
284
285
        // Maintain scheme
286
        if (false !== ($pos = strpos($path, '://'))) {
287
            $scheme = substr($path, 0, $pos + 3);
288
            $path = substr($path, $pos + 3);
289
        } else {
290
            $scheme = '';
291
        }
292
293
        // UNIX root "/" or "\" (Windows style)
294
        if ('/' === $path[0] || '\\' === $path[0]) {
@@ 601-606 (lines=6) @@
598
            return static::canonicalize($path);
599
        }
600
601
        if (false !== ($pos = strpos($basePath, '://'))) {
602
            $scheme = substr($basePath, 0, $pos + 3);
603
            $basePath = substr($basePath, $pos + 3);
604
        } else {
605
            $scheme = '';
606
        }
607
608
        return $scheme.self::canonicalize(rtrim($basePath, '/\\').'/'.$path);
609
    }
@@ 965-970 (lines=6) @@
962
        }
963
964
        // Remember scheme as part of the root, if any
965
        if (false !== ($pos = strpos($path, '://'))) {
966
            $root = substr($path, 0, $pos + 3);
967
            $path = substr($path, $pos + 3);
968
        } else {
969
            $root = '';
970
        }
971
972
        $length = strlen($path);
973