AddConfirm   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 52
Duplicated Lines 7.69 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 2
Bugs 1 Features 2
Metric Value
wmc 3
c 2
b 1
f 2
lcom 1
cbo 5
dl 4
loc 52
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B play() 4 35 3

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
/**
3
 * AddConfirm
4
 *
5
 * ユーザ追加画面(確認)を実現するためのクラス
6
 *
7
 * @package           risoluto
8
 * @author            Risoluto Developers
9
 * @license           http://opensource.org/licenses/bsd-license.php new BSD license
10
 * @copyright     (C) 2008-2015 Risoluto Developers / All Rights Reserved.
11
 */
12
13
//------------------------------------------------------//
14
// 名前空間の定義
15
//------------------------------------------------------//
16
namespace RisolutoApps\Admin\UserMng;
17
18
//------------------------------------------------------//
19
// クラス定義
20
//------------------------------------------------------//
21
class AddConfirm extends \Risoluto\RisolutoControllerBase implements \Risoluto\RisolutoControllerInterface
22
{
23
    // View関連の処理を使用する
24
    use \Risoluto\RisolutoViewTrait;
25
26
    /**
27
     * play()
28
     *
29
     * 主処理を行う
30
     *
31
     * @access    public
32
     *
33
     * @param     void
34
     *
35
     * @return    void    なし
36
     */
37
    public function play()
38
    {
39
        // セッションをスタート
40
        $sess = new \Risoluto\Session();
41
        $sess->start();
42
43
        // 共通処理クラスを呼び出し
44
        $common = new \RisolutoApps\Admin\AdminCommon;
45
        $detail = $common->loginCheck( $sess, true );
46
        $groups = $common->getGroupList( 'id_and_name' );
47
        $entered = $common->checkEnteredUserData( $_POST, $sess->load( 'csrf_token' ) );
48
49
        // 入力情報はセッションに保存
50
        $sess->store( 'form', $entered );
51
52
        // エラー情報があった場合は入力画面に戻る
53 View Code Duplication
        if (!empty( $entered[ 'error' ][ 'msg' ] ) or !empty( $entered[ 'error' ][ 'form_crit' ] )) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
54
            \Risoluto\Url::redirectTo( 'Admin_UserMng_AddEntry' );
55
            exit;
56
        }
57
58
        // ヘッダ情報のセット
59
        $header = $this->getDefaultHeader();
60
        $header = $this->replaceHeader( $header, 'robots', 'NOINDEX,NOFOLLOW' );
61
62
        // テンプレートエンジン関連の処理
63
        $assign_value = [
64
            'header' => $header,
65
            'detail' => $detail,
66
            'groups' => $groups,
67
            'entered' => $entered,
68
            'csrf_token' => $sess->load( 'csrf_token' )
69
        ];
70
        $this->risolutoView( $assign_value );
71
    }
72
}