AddEntry   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 49
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
B play() 32 32 2

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
 * AddEntry
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 View Code Duplication
class AddEntry 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( 'name_only' );
47
48
        // セッションにフォーム入力情報が存在した場合は取得
49
        $entered = [ ];
50
        if ($sess->isThere( 'form' )) {
51
            $entered = $sess->load( 'form' );
52
            $sess->revoke( 'form' );
53
        }
54
55
        // ヘッダ情報のセット
56
        $header = $this->getDefaultHeader();
57
        $header = $this->replaceHeader( $header, 'robots', 'NOINDEX,NOFOLLOW' );
58
59
        // テンプレートエンジン関連の処理
60
        $assign_value = [
61
            'header' => $header,
62
            'detail' => $detail,
63
            'groups' => $groups,
64
            'entered' => $entered,
65
            'csrf_token' => $sess->load( 'csrf_token' )
66
        ];
67
        $this->risolutoView( $assign_value );
68
    }
69
}