Code Duplication    Length = 16-16 lines in 2 locations

code/blocks/slider/models/VideoSliderItem.php 1 location

@@ 351-366 (lines=16) @@
348
            $fileContent = file_get_contents($fileContent[0]['thumbnail_large']);
349
        }
350
351
        if ($fileContent) {
352
            if (file_put_contents($absoluteFileName = ($baseFolder.$fileName), $fileContent)) {
353
                $image = Image::create([
354
                    "Filename" => $folder->getFilename().$fileName,
355
                    "Title"    => $this->Title,
356
                    "Name"     => $fileName,
357
                    "ParentID" => $folder->ID,
358
                    "OwnerID"  => Member::currentUserID(),
359
                ]);
360
361
                if ($image->write()) {
362
                    $this->CoverID = $image->ID;
363
                    $this->write();
364
                }
365
            }
366
        }
367
    }
368
369
}

code/blocks/video/models/VideoBlock.php 1 location

@@ 358-373 (lines=16) @@
355
                break;
356
        }
357
358
        if ($fileContent) {
359
            if (file_put_contents($absoluteFileName = ($baseFolder.$fileName), $fileContent)) {
360
                $image = Image::create([
361
                    "Filename" => $folder->getFilename().$fileName,
362
                    "Title"    => $this->Title,
363
                    "Name"     => $fileName,
364
                    "ParentID" => $folder->ID,
365
                    "OwnerID"  => Member::currentUserID(),
366
                ]);
367
368
                if ($image->write()) {
369
                    $this->CoverID = $image->ID;
370
                    $this->write();
371
                }
372
            }
373
        }
374
    }
375
376
    public function renderVideo() {