AddConfirm::play()   B
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 35
Code Lines 20

Duplication

Lines 4
Ratio 11.43 %

Importance

Changes 2
Bugs 1 Features 2
Metric Value
c 2
b 1
f 2
dl 4
loc 35
rs 8.8571
cc 3
eloc 20
nc 2
nop 0
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
}