Code Duplication    Length = 5-5 lines in 2 locations

src/Model/Behavior/Traits/NormalContentsFileBehaviorTrait.php 1 location

@@ 57-61 (lines=5) @@
54
    {
55
        $newFiledir = Configure::read('ContentsFile.Setting.Normal.fileDir') . $attachmentSaveData['model'] . '/' . $attachmentSaveData['model_id'] . '/';
56
        // ランダムパスの場合の分岐
57
        if (Configure::read('ContentsFile.Setting.randomFile') === true) {
58
            $newFilepath = $newFiledir . $attachmentSaveData['file_random_path'];
59
        } else {
60
            $newFilepath = $newFiledir . $fileInfo['field_name'];
61
        }
62
63
        if (Configure::read('ContentsFile.Setting.ext') === true) {
64
            $ext = (new \SplFileInfo($attachmentSaveData['file_name']))->getExtension();

src/Model/Behavior/Traits/S3ContentsFileBehaviorTrait.php 1 location

@@ 68-72 (lines=5) @@
65
    {
66
        $S3 = new S3();
67
        $newFiledir = Configure::read('ContentsFile.Setting.S3.fileDir') . $attachmentSaveData['model'] . '/' . $attachmentSaveData['model_id'] . '/';
68
        if (Configure::read('ContentsFile.Setting.randomFile') === true) {
69
            $newFilepath = $newFiledir . $attachmentSaveData['file_random_path'];
70
        } else {
71
            $newFilepath = $newFiledir . $fileInfo['field_name'];
72
        }
73
        if (Configure::read('ContentsFile.Setting.ext') === true) {
74
            $ext = (new \SplFileInfo($attachmentSaveData['file_name']))->getExtension();
75
            $newFilepath .= '.' . $ext;