Code Duplication    Length = 8-11 lines in 2 locations

src/AbstractPathMappingRepository.php 1 location

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

src/FilesystemRepository.php 1 location

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