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 "/"
@@ 282-287 (lines=6) @@
279
        Assert::string($path, 'The path must be a string. Got: %s');
280
281
        // Maintain scheme
282
        if (false !== ($pos = strpos($path, '://'))) {
283
            $scheme = substr($path, 0, $pos + 3);
284
            $path = substr($path, $pos + 3);
285
        } else {
286
            $scheme = '';
287
        }
288
289
        // UNIX root "/" or "\" (Windows style)
290
        if ('/' === $path[0] || '\\' === $path[0]) {
@@ 597-602 (lines=6) @@
594
            return static::canonicalize($path);
595
        }
596
597
        if (false !== ($pos = strpos($basePath, '://'))) {
598
            $scheme = substr($basePath, 0, $pos + 3);
599
            $basePath = substr($basePath, $pos + 3);
600
        } else {
601
            $scheme = '';
602
        }
603
604
        return $scheme.self::canonicalize(rtrim($basePath, '/\\').'/'.$path);
605
    }
@@ 961-966 (lines=6) @@
958
        }
959
960
        // Remember scheme as part of the root, if any
961
        if (false !== ($pos = strpos($path, '://'))) {
962
            $root = substr($path, 0, $pos + 3);
963
            $path = substr($path, $pos + 3);
964
        } else {
965
            $root = '';
966
        }
967
968
        $length = strlen($path);
969