Code Duplication    Length = 8-11 lines in 2 locations

src/AbstractJsonRepository.php 1 location

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

src/FilesystemRepository.php 1 location

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