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

@@ 108-118 (lines=11) @@
105
106
        $path = $this->sanitizePath($path);
107
108
        if ($resource instanceof ResourceCollection) {
109
            $this->ensureDirectoryExists($path);
110
111
            foreach ($resource as $child) {
112
                $this->addResource($path.'/'.$child->getName(), $child);
113
            }
114
115
            $this->flush();
116
117
            return;
118
        }
119
120
        $this->ensureDirectoryExists(Path::getDirectory($path));
121