Code Duplication    Length = 8-11 lines in 2 locations

src/FilesystemRepository.php 1 location

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

src/AbstractJsonRepository.php 1 location

@@ 135-145 (lines=11) @@
132
133
        $path = $this->sanitizePath($path);
134
135
        if ($resource instanceof ResourceCollection) {
136
            $this->ensureDirectoryExists($path);
137
138
            foreach ($resource as $child) {
139
                $this->addResource($path.'/'.$child->getName(), $child);
140
            }
141
142
            $this->flush();
143
144
            return;
145
        }
146
147
        $this->ensureDirectoryExists(Path::getDirectory($path));
148