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

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