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

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