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

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