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]) {
@@ 595-600 (lines=6) @@
592
            return static::canonicalize($path);
593
        }
594
595
        if (false !== ($pos = strpos($basePath, '://'))) {
596
            $scheme = substr($basePath, 0, $pos + 3);
597
            $basePath = substr($basePath, $pos + 3);
598
        } else {
599
            $scheme = '';
600
        }
601
602
        return $scheme.self::canonicalize(rtrim($basePath, '/\\').'/'.$path);
603
    }
@@ 959-964 (lines=6) @@
956
        }
957
958
        // Remember scheme as part of the root, if any
959
        if (false !== ($pos = strpos($path, '://'))) {
960
            $root = substr($path, 0, $pos + 3);
961
            $path = substr($path, $pos + 3);
962
        } else {
963
            $root = '';
964
        }
965
966
        $length = strlen($path);
967