This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * AdminCommon |
||
4 | * |
||
5 | * Admin系共通処理処理を実現するためのクラス |
||
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; |
||
17 | |||
18 | //------------------------------------------------------// |
||
19 | // クラス定義 |
||
20 | //------------------------------------------------------// |
||
21 | class AdminCommon |
||
22 | { |
||
23 | /** |
||
24 | * loginCheck(\Risoluto\Session $sess, $admin = true) |
||
25 | * |
||
26 | * ログインチェック処理を行う |
||
27 | * |
||
28 | * @access public |
||
29 | * |
||
30 | * @param \Risoluto\Session $sess セッションオブジェクト |
||
31 | * @param boolean $admin 管理者権限必須か否か(true:必須、デフォルト/false:ログイン成功なら誰でもOK) |
||
32 | * |
||
33 | * @return array 認証情報 |
||
34 | * @throws \Exception 管理者権限必須の時に権限を持ってないユーザの場合はThrow |
||
35 | */ |
||
36 | public function loginCheck( \Risoluto\Session $sess, $admin = true ) |
||
37 | { |
||
38 | if ($sess->isThere( 'Auth' )) { |
||
39 | // 認証情報がある場合は取得する |
||
40 | $detail = $sess->Load( 'Auth' ); |
||
41 | |||
42 | if ($admin and $detail[ 'groupno' ] != 1) { |
||
43 | // 管理者権限を持っていない場合はエラー |
||
44 | throw new \Exception( 'Admin user required' ); |
||
45 | } else { |
||
46 | // 管理者権限を持っている場合はそのまま戻る |
||
47 | return $detail; |
||
48 | } |
||
49 | } else { |
||
50 | // 認証情報がない場合はログイン画面へ遷移する |
||
51 | $sess->store( 'AuthError', 'invalid_access' ); |
||
52 | \Risoluto\Url::redirectTo( 'Admin_Login' ); |
||
53 | exit; |
||
54 | } |
||
55 | } |
||
56 | |||
57 | /** |
||
58 | * getGroupList($mode = '') |
||
59 | * |
||
60 | * グループリスト取得処理を行う |
||
61 | * |
||
62 | * @access public |
||
63 | * |
||
64 | * @param string $mode 取得モード(name_only / id_and_name) |
||
65 | * |
||
66 | * @return array 取得したグループリスト |
||
67 | */ |
||
68 | public function getGroupList( $mode = '' ) |
||
69 | { |
||
70 | // まずはグループ情報を普通に取得 |
||
71 | $grouplist = \Risoluto\Auth::callProviderMethod( 'showGroupAll' ); |
||
72 | $retval = [ ]; |
||
73 | |||
74 | // 指定されたモードによって返却する配列を変える |
||
75 | foreach ($grouplist as $dat) { |
||
76 | switch ($mode) { |
||
77 | case 'name_only': |
||
78 | $retval[ $dat[ 'no' ] ] = $dat[ 'groupname' ]; |
||
79 | break; |
||
80 | |||
81 | case 'id_and_name': // FALL THRU |
||
82 | default: |
||
83 | $retval[ $dat[ 'no' ] ] = [ 'id' => $dat[ 'groupid' ], 'name' => $dat[ 'groupname' ] ]; |
||
84 | break; |
||
85 | } |
||
86 | } |
||
87 | |||
88 | // 処理結果を返却する |
||
89 | return $retval; |
||
90 | } |
||
91 | |||
92 | /** |
||
93 | * checkEnteredUserData($target, $csrf_token) |
||
94 | * |
||
95 | * 入力内容のチェック処理を行う |
||
96 | * |
||
97 | * @access public |
||
98 | * |
||
99 | * @param array $target チェック対象となるデータが格納された配列 |
||
100 | * @param string $csrf_token CSRF対策のためのトークン |
||
101 | * @param integer $selfno 自分自身のユーザno(省略可、省略された場合はユーザIDの重複チェック時に考慮) |
||
102 | * |
||
103 | * @return array チェック結果 |
||
104 | * @throws \Exception CSRFトークンが一致しなかった場合はThrow |
||
105 | */ |
||
106 | public function checkEnteredUserData( $target, $csrf_token, $selfno = '' ) |
||
107 | { |
||
108 | // 戻り値を初期化 |
||
109 | $retval = [ ]; |
||
110 | $retval[ 'entered' ] = [ ]; |
||
111 | $retval[ 'error' ][ 'msg' ] = [ ]; |
||
112 | $retval[ 'error' ][ 'form_crit' ] = [ ]; |
||
113 | |||
114 | //--- ユーザIDのチェック |
||
115 | $dup_master = \Risoluto\Auth::callProviderMethod( 'showUser', [ 'userid' => $target[ 'userid' ] ] ); |
||
116 | $retval[ 'entered' ][ 'userid' ] = htmlentities( $target[ 'userid' ], ENT_QUOTES, 'UTF-8' ); |
||
117 | View Code Duplication | if (isset( $target[ 'userid' ] ) and !empty( $target[ 'userid' ] )) { |
|
0 ignored issues
–
show
|
|||
118 | if (!empty( $selfno )) { |
||
119 | // 自分自身のユーザnoがセットされている場合は、重複データにそれが含まれていないかを確認する |
||
120 | $retval[ 'entered' ][ 'no' ] = $selfno; |
||
121 | $dups = [ ]; |
||
122 | foreach ($dup_master as $dat) { |
||
123 | if ($dat[ 'no' ] != $selfno) { |
||
124 | $dups[ ] = $dat; |
||
125 | } |
||
126 | } |
||
127 | } else { |
||
128 | // セットされていない場合は取得したものをそのまま使う |
||
129 | $dups = $dup_master; |
||
130 | } |
||
131 | |||
132 | // フォーマットチェック |
||
133 | if (!preg_match( '/[[:alnum:]\_\-\@\.]{1,255}/', $target[ 'userid' ] ) or count( $dups ) > 0) { |
||
134 | // フォーマットにそぐわない場合はエラーにする |
||
135 | $retval[ 'error' ][ 'msg' ][ ] = 'invalid_userid'; |
||
136 | $retval[ 'error' ][ 'form_crit' ][ ] = 'userid'; |
||
137 | } |
||
138 | } else { |
||
139 | // 未入力の場合はエラーにする |
||
140 | $retval[ 'entered' ][ 'userid' ] = ''; |
||
141 | $retval[ 'error' ][ 'msg' ][ ] = 'empty_userid'; |
||
142 | $retval[ 'error' ][ 'form_crit' ][ ] = 'userid'; |
||
143 | } |
||
144 | |||
145 | //--- ユーザ名のチェック |
||
146 | $retval[ 'entered' ][ 'username' ] = htmlentities( $target[ 'username' ], ENT_QUOTES, 'UTF-8' ); |
||
147 | View Code Duplication | if (isset( $target[ 'username' ] ) and !empty( $target[ 'username' ] )) { |
|
0 ignored issues
–
show
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...
|
|||
148 | // フォーマットチェック |
||
149 | if (strlen( $target[ 'username' ] ) > 255) { |
||
150 | // フォーマットにそぐわない場合はエラーにする |
||
151 | $retval[ 'error' ][ 'msg' ][ ] = 'invalid_username'; |
||
152 | $retval[ 'error' ][ 'form_crit' ][ ] = 'username'; |
||
153 | } |
||
154 | } else { |
||
155 | // 未入力の場合はエラーにする |
||
156 | $retval[ 'entered' ][ 'username' ] = ''; |
||
157 | $retval[ 'error' ][ 'msg' ][ ] = 'empty_username'; |
||
158 | $retval[ 'error' ][ 'form_crit' ][ ] = 'username'; |
||
159 | } |
||
160 | |||
161 | //--- パスワードのチェック |
||
162 | $retval[ 'entered' ][ 'password' ] = htmlentities( $target[ 'password' ], ENT_QUOTES, 'UTF-8' ); |
||
163 | $retval[ 'entered' ][ 'password_confirm' ] = $retval[ 'entered' ][ 'password' ]; |
||
164 | View Code Duplication | if (isset( $target[ 'password' ] ) and !empty( $target[ 'password' ] )) { |
|
0 ignored issues
–
show
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...
|
|||
165 | // フォーマットチェック |
||
166 | if ($target[ 'password' ] != $target[ 'password_confirm' ]) { |
||
167 | // フォーマットにそぐわない場合はエラーにする |
||
168 | $retval[ 'error' ][ 'msg' ][ ] = 'invalid_password'; |
||
169 | $retval[ 'error' ][ 'form_crit' ][ ] = 'password'; |
||
170 | } |
||
171 | } else { |
||
172 | // 未入力の場合はエラーにする |
||
173 | $retval[ 'entered' ][ 'password' ] = ''; |
||
174 | $retval[ 'entered' ][ 'password_confirm' ] = ''; |
||
175 | $retval[ 'error' ][ 'msg' ][ ] = 'empty_password'; |
||
176 | $retval[ 'error' ][ 'form_crit' ][ ] = 'password'; |
||
177 | } |
||
178 | |||
179 | //--- 所属グループのチェック |
||
180 | $retval[ 'entered' ][ 'groupno' ] = htmlentities( $target[ 'groupno' ], ENT_QUOTES, 'UTF-8' ); |
||
181 | View Code Duplication | if (isset( $target[ 'groupno' ] )) { |
|
0 ignored issues
–
show
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...
|
|||
182 | // フォーマットチェック |
||
183 | if (!preg_match( '/\d{1,}/', $target[ 'groupno' ] )) { |
||
184 | // フォーマットにそぐわない場合はエラーにする |
||
185 | $retval[ 'error' ][ 'msg' ][ ] = 'invalid_groupno'; |
||
186 | $retval[ 'error' ][ 'form_crit' ][ ] = 'groupno'; |
||
187 | } |
||
188 | } else { |
||
189 | // 未入力の場合はエラーにする |
||
190 | $retval[ 'entered' ][ 'groupno' ] = ''; |
||
191 | $retval[ 'error' ][ 'msg' ][ ] = 'empty_groupno'; |
||
192 | $retval[ 'error' ][ 'form_crit' ][ ] = 'groupno'; |
||
193 | } |
||
194 | |||
195 | //--- ステータスのチェック |
||
196 | $retval[ 'entered' ][ 'status' ] = htmlentities( $target[ 'status' ], ENT_QUOTES, 'UTF-8' ); |
||
197 | View Code Duplication | if (isset( $target[ 'status' ] )) { |
|
0 ignored issues
–
show
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...
|
|||
198 | // フォーマットチェック |
||
199 | if (!preg_match( '/\d{1,}/', $target[ 'status' ] )) { |
||
200 | // フォーマットにそぐわない場合はエラーにする |
||
201 | $retval[ 'error' ][ 'msg' ][ ] = 'invalid_status'; |
||
202 | $retval[ 'error' ][ 'form_crit' ][ ] = 'status'; |
||
203 | } |
||
204 | } else { |
||
205 | // 未入力の場合はエラーにする |
||
206 | $retval[ 'entered' ][ 'status' ] = ''; |
||
207 | $retval[ 'error' ][ 'msg' ][ ] = 'empty_status'; |
||
208 | $retval[ 'error' ][ 'form_crit' ][ ] = 'status'; |
||
209 | } |
||
210 | |||
211 | //--- CSRFトークンのチェック |
||
212 | if ($target[ 'csrf_token' ] != $csrf_token) { |
||
213 | throw new \Exception( 'CSRF Check Error' ); |
||
214 | } |
||
215 | |||
216 | // エラー関係の配列から重複を排除する |
||
217 | $retval[ 'error' ][ 'msg' ] = array_unique( $retval[ 'error' ][ 'msg' ] ); |
||
218 | $retval[ 'error' ][ 'form_crit' ] = array_unique( $retval[ 'error' ][ 'form_crit' ] ); |
||
219 | |||
220 | // 処理結果を返却する |
||
221 | return $retval; |
||
222 | } |
||
223 | |||
224 | /** |
||
225 | * checkEnteredGroupData($target, $csrf_token) |
||
226 | * |
||
227 | * 入力内容のチェック処理を行う |
||
228 | * |
||
229 | * @access public |
||
230 | * |
||
231 | * @param array $target チェック対象となるデータが格納された配列 |
||
232 | * @param string $csrf_token CSRF対策のためのトークン |
||
233 | * @param integer $selfno 自分自身のユーザno(省略可、省略された場合はユーザIDの重複チェック時に考慮) |
||
234 | * |
||
235 | * @return array チェック結果 |
||
236 | * @throws \Exception CSRFトークンが一致しなかった場合はThrow |
||
237 | */ |
||
238 | public function checkEnteredGroupData( $target, $csrf_token, $selfno = '' ) |
||
239 | { |
||
240 | // 戻り値を初期化 |
||
241 | $retval = [ ]; |
||
242 | $retval[ 'entered' ] = [ ]; |
||
243 | $retval[ 'error' ][ 'msg' ] = [ ]; |
||
244 | $retval[ 'error' ][ 'form_crit' ] = [ ]; |
||
245 | |||
246 | //--- グループIDのチェック |
||
247 | $dup_master = \Risoluto\Auth::callProviderMethod( 'showGroup', [ 'groupid' => $target[ 'groupid' ] ] ); |
||
248 | $retval[ 'entered' ][ 'groupid' ] = htmlentities( $target[ 'groupid' ], ENT_QUOTES, 'UTF-8' ); |
||
249 | View Code Duplication | if (isset( $target[ 'groupid' ] ) and !empty( $target[ 'groupid' ] )) { |
|
0 ignored issues
–
show
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...
|
|||
250 | if (!empty( $selfno )) { |
||
251 | // 自分自身のユーザnoがセットされている場合は、重複データにそれが含まれていないかを確認する |
||
252 | $retval[ 'entered' ][ 'no' ] = $selfno; |
||
253 | $dups = [ ]; |
||
254 | foreach ($dup_master as $dat) { |
||
255 | if ($dat[ 'no' ] != $selfno) { |
||
256 | $dups[ ] = $dat; |
||
257 | } |
||
258 | } |
||
259 | } else { |
||
260 | // セットされていない場合は取得したものをそのまま使う |
||
261 | $dups = $dup_master; |
||
262 | } |
||
263 | |||
264 | // フォーマットチェック |
||
265 | if (!preg_match( '/[[:alnum:]\_\-\@\.]{1,255}/', $target[ 'groupid' ] ) or count( $dups ) > 0) { |
||
266 | // フォーマットにそぐわない場合はエラーにする |
||
267 | $retval[ 'error' ][ 'msg' ][ ] = 'invalid_groupid'; |
||
268 | $retval[ 'error' ][ 'form_crit' ][ ] = 'groupid'; |
||
269 | } |
||
270 | } else { |
||
271 | // 未入力の場合はエラーにする |
||
272 | $retval[ 'entered' ][ 'groupid' ] = ''; |
||
273 | $retval[ 'error' ][ 'msg' ][ ] = 'empty_groupid'; |
||
274 | $retval[ 'error' ][ 'form_crit' ][ ] = 'groupid'; |
||
275 | } |
||
276 | |||
277 | //--- グループ名のチェック |
||
278 | $retval[ 'entered' ][ 'groupname' ] = htmlentities( $target[ 'groupname' ], ENT_QUOTES, 'UTF-8' ); |
||
279 | View Code Duplication | if (isset( $target[ 'groupname' ] ) and !empty( $target[ 'groupname' ] )) { |
|
0 ignored issues
–
show
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...
|
|||
280 | // フォーマットチェック |
||
281 | if (strlen( $target[ 'groupname' ] ) > 255) { |
||
282 | // フォーマットにそぐわない場合はエラーにする |
||
283 | $retval[ 'error' ][ 'msg' ][ ] = 'invalid_groupname'; |
||
284 | $retval[ 'error' ][ 'form_crit' ][ ] = 'groupname'; |
||
285 | } |
||
286 | } else { |
||
287 | // 未入力の場合はエラーにする |
||
288 | $retval[ 'entered' ][ 'groupname' ] = ''; |
||
289 | $retval[ 'error' ][ 'msg' ][ ] = 'empty_groupname'; |
||
290 | $retval[ 'error' ][ 'form_crit' ][ ] = 'groupname'; |
||
291 | } |
||
292 | |||
293 | //--- ステータスのチェック |
||
294 | $retval[ 'entered' ][ 'status' ] = htmlentities( $target[ 'status' ], ENT_QUOTES, 'UTF-8' ); |
||
295 | View Code Duplication | if (isset( $target[ 'status' ] )) { |
|
0 ignored issues
–
show
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...
|
|||
296 | // フォーマットチェック |
||
297 | if (!preg_match( '/\d{1,}/', $target[ 'status' ] )) { |
||
298 | // フォーマットにそぐわない場合はエラーにする |
||
299 | $retval[ 'error' ][ 'msg' ][ ] = 'invalid_status'; |
||
300 | $retval[ 'error' ][ 'form_crit' ][ ] = 'status'; |
||
301 | } |
||
302 | } else { |
||
303 | // 未入力の場合はエラーにする |
||
304 | $retval[ 'entered' ][ 'status' ] = ''; |
||
305 | $retval[ 'error' ][ 'msg' ][ ] = 'empty_status'; |
||
306 | $retval[ 'error' ][ 'form_crit' ][ ] = 'status'; |
||
307 | } |
||
308 | |||
309 | //--- CSRFトークンのチェック |
||
310 | if ($target[ 'csrf_token' ] != $csrf_token) { |
||
311 | throw new \Exception( 'CSRF Check Error' ); |
||
312 | } |
||
313 | |||
314 | // エラー関係の配列から重複を排除する |
||
315 | $retval[ 'error' ][ 'msg' ] = array_unique( $retval[ 'error' ][ 'msg' ] ); |
||
316 | $retval[ 'error' ][ 'form_crit' ] = array_unique( $retval[ 'error' ][ 'form_crit' ] ); |
||
317 | |||
318 | // 処理結果を返却する |
||
319 | return $retval; |
||
320 | } |
||
321 | |||
322 | /** |
||
323 | * checkEnteredSelfData($target, $csrf_token) |
||
324 | * |
||
325 | * 入力内容のチェック処理を行う |
||
326 | * |
||
327 | * @access public |
||
328 | * |
||
329 | * @param array $target チェック対象となるデータが格納された配列 |
||
330 | * @param string $csrf_token CSRF対策のためのトークン |
||
331 | * @param integer $no ユーザ識別用のNo |
||
332 | * |
||
333 | * @return array チェック結果 |
||
334 | * @throws \Exception CSRFトークンが一致しなかった場合はThrow |
||
335 | */ |
||
336 | public function checkEnteredSelfData( $target, $csrf_token, $no ) |
||
337 | { |
||
338 | // 戻り値を初期化 |
||
339 | $retval = [ ]; |
||
340 | $retval[ 'entered' ] = [ ]; |
||
341 | $retval[ 'error' ][ 'msg' ] = [ ]; |
||
342 | $retval[ 'error' ][ 'form_crit' ] = [ ]; |
||
343 | |||
344 | //--- 現在のパスワードのチェック |
||
345 | $retval[ 'entered' ][ 'current_password' ] = htmlentities( $target[ 'current_password' ], ENT_QUOTES, 'UTF-8' ); |
||
346 | $current_pw_db = \Risoluto\Auth::callProviderMethod( 'showUserByNo', [ 'no' => $no ] ); |
||
347 | View Code Duplication | if (isset( $target[ 'current_password' ] ) and !empty( $target[ 'current_password' ] )) { |
|
0 ignored issues
–
show
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...
|
|||
348 | // フォーマットチェック |
||
349 | if (!password_verify( $target[ 'current_password' ], $current_pw_db[ 0 ][ 'password' ] )) { |
||
350 | // フォーマットにそぐわない場合はエラーにする |
||
351 | $retval[ 'error' ][ 'msg' ][ ] = 'invalid_current_password'; |
||
352 | $retval[ 'error' ][ 'form_crit' ][ ] = 'current_password'; |
||
353 | } |
||
354 | } else { |
||
355 | // 未入力の場合はエラーにする |
||
356 | $retval[ 'entered' ][ 'current_password' ] = ''; |
||
357 | $retval[ 'error' ][ 'msg' ][ ] = 'empty_current_password'; |
||
358 | $retval[ 'error' ][ 'form_crit' ][ ] = 'current_password'; |
||
359 | } |
||
360 | |||
361 | //--- 変更後のパスワードのチェック |
||
362 | $retval[ 'entered' ][ 'password' ] = htmlentities( $target[ 'password' ], ENT_QUOTES, 'UTF-8' ); |
||
363 | $retval[ 'entered' ][ 'password_confirm' ] = $retval[ 'entered' ][ 'password' ]; |
||
364 | View Code Duplication | if (isset( $target[ 'password' ] ) and !empty( $target[ 'password' ] )) { |
|
0 ignored issues
–
show
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...
|
|||
365 | // フォーマットチェック |
||
366 | if ($target[ 'password' ] != $target[ 'password_confirm' ]) { |
||
367 | // フォーマットにそぐわない場合はエラーにする |
||
368 | $retval[ 'error' ][ 'msg' ][ ] = 'invalid_password'; |
||
369 | $retval[ 'error' ][ 'form_crit' ][ ] = 'password'; |
||
370 | } |
||
371 | } else { |
||
372 | // 未入力の場合はエラーにする |
||
373 | $retval[ 'entered' ][ 'password' ] = ''; |
||
374 | $retval[ 'entered' ][ 'password_confirm' ] = ''; |
||
375 | $retval[ 'error' ][ 'msg' ][ ] = 'empty_password'; |
||
376 | $retval[ 'error' ][ 'form_crit' ][ ] = 'password'; |
||
377 | } |
||
378 | |||
379 | //--- CSRFトークンのチェック |
||
380 | if ($target[ 'csrf_token' ] != $csrf_token) { |
||
381 | throw new \Exception( 'CSRF Check Error' ); |
||
382 | } |
||
383 | |||
384 | // エラー関係の配列から重複を排除する |
||
385 | $retval[ 'error' ][ 'msg' ] = array_unique( $retval[ 'error' ][ 'msg' ] ); |
||
386 | $retval[ 'error' ][ 'form_crit' ] = array_unique( $retval[ 'error' ][ 'form_crit' ] ); |
||
387 | |||
388 | // 処理結果を返却する |
||
389 | return $retval; |
||
390 | } |
||
391 | } |
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.