Code Duplication    Length = 8-11 lines in 2 locations

src/AbstractPathMappingRepository.php 1 location

@@ 76-86 (lines=11) @@
73
    {
74
        $path = $this->sanitizePath($path);
75
76
        if ($resource instanceof ResourceCollection) {
77
            $this->ensureDirectoryExists($path);
78
79
            foreach ($resource as $child) {
80
                $this->addResource($path.'/'.$child->getName(), $child);
81
            }
82
83
            $this->sortStore();
84
85
            return;
86
        }
87
88
        $this->ensureDirectoryExists(Path::getDirectory($path));
89
        $this->addResource($path, $resource);

src/FilesystemRepository.php 1 location

@@ 213-220 (lines=8) @@
210
    {
211
        $path = $this->sanitizePath($path);
212
213
        if ($resource instanceof ResourceCollection) {
214
            $this->ensureDirectoryExists($path);
215
            foreach ($resource as $child) {
216
                $this->addResource($path.'/'.$child->getName(), $child);
217
            }
218
219
            return;
220
        }
221
222
        if ($resource instanceof PuliResource) {
223
            $this->ensureDirectoryExists(Path::getDirectory($path));