Code Duplication    Length = 5-5 lines in 2 locations

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

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

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

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