Code Duplication    Length = 12-12 lines in 2 locations

src/FileInfo.php 2 locations

@@ 156-167 (lines=12) @@
153
     *
154
     * @return string
155
     */
156
    public function getPathRelativeTo($basePath)
157
    {
158
        $basePath = $this->purifyPath($basePath).static::SEPARATOR_DIRECTORY;
159
160
        $relativePath = $this->getPath();
161
        $prefix = mb_substr($relativePath, 0, mb_strlen($basePath));
162
        if ($prefix === $basePath) {
163
            $relativePath = mb_substr($relativePath, mb_strlen($prefix));
164
        }
165
166
        return $relativePath;
167
    }
168
169
    /**
170
     * @param string $basePathname
@@ 174-185 (lines=12) @@
171
     *
172
     * @return string
173
     */
174
    public function getPathnameRelativeTo($basePathname)
175
    {
176
        $basePathname = $this->purifyPath($basePathname).static::SEPARATOR_DIRECTORY;
177
178
        $relativePathname = $this->getPathname();
179
        $prefix = mb_substr($relativePathname, 0, mb_strlen($basePathname));
180
        if ($prefix === $basePathname) {
181
            $relativePathname = mb_substr($relativePathname, mb_strlen($prefix));
182
        }
183
184
        return $relativePathname;
185
    }
186
187
    /**
188
     * Converts object to a string representation.