Code Duplication    Length = 10-12 lines in 2 locations

src/Aws/S3.php 1 location

@@ 27-36 (lines=10) @@
24
    {
25
        // S3に必要な設定がそろっているかチェックする
26
        $S3Setting = Configure::read('ContentsFile.Setting.S3');
27
        if (
28
            !is_array($S3Setting) ||
29
            !array_key_exists('key', $S3Setting) ||
30
            !array_key_exists('secret', $S3Setting) ||
31
            !array_key_exists('bucket', $S3Setting) ||
32
            !array_key_exists('tmpDir', $S3Setting) ||
33
            !array_key_exists('fileDir', $S3Setting)
34
        ) {
35
            throw new InternalErrorException('contentsFileS3Config paramater shortage');
36
        }
37
        // S3に接続するためのクライアントを用意します。
38
        $key    = Configure::read('ContentsFile.Setting.S3.key');
39
        $secret = Configure::read('ContentsFile.Setting.S3.secret');

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

@@ 30-41 (lines=12) @@
27
    {
28
        // S3に必要な設定がそろっているかチェックする
29
        $s3Setting = Configure::read('ContentsFile.Setting.S3');
30
        if (
31
            !is_array($s3Setting) ||
32
            !array_key_exists('key', $s3Setting) ||
33
            !array_key_exists('secret', $s3Setting) ||
34
            !array_key_exists('bucket', $s3Setting) ||
35
            !array_key_exists('tmpDir', $s3Setting) ||
36
            !array_key_exists('fileDir', $s3Setting) ||
37
            !array_key_exists('workingDir', $s3Setting)
38
39
        ) {
40
            throw new InternalErrorException('contentsFileS3Config paramater shortage');
41
        }
42
43
        // /が最後についていない場合はつける
44
        if (!preg_match('#/$#', $s3Setting['tmpDir'])) {