Code Duplication    Length = 8-11 lines in 2 locations

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));

src/AbstractJsonRepository.php 1 location

@@ 117-127 (lines=11) @@
114
115
        $path = $this->sanitizePath($path);
116
117
        if ($resource instanceof ResourceCollection) {
118
            $this->ensureDirectoryExists($path);
119
120
            foreach ($resource as $child) {
121
                $this->addResource($path.'/'.$child->getName(), $child);
122
            }
123
124
            $this->flush();
125
126
            return;
127
        }
128
129
        $this->ensureDirectoryExists(Path::getDirectory($path));
130