User: func_get_args() 廃止
@@ -231,39 +231,39 @@ | ||
231 | 231 | } |
232 | 232 | |
233 | 233 | //役職判定 |
234 | - public function IsRole($role) { | |
235 | - $stack = func_get_args(); | |
236 | - $list = $this->role_list; | |
237 | - if ($stack[0] === true) { //仮想役職対応 | |
238 | - array_shift($stack); | |
239 | - if (isset($this->virtual_role)) { | |
240 | - $list[] = $this->virtual_role; | |
234 | + public function IsRole(...$target_list) { | |
235 | + $role_list = $this->role_list; | |
236 | + if (true === $target_list[0]) { //仮想役職対応 | |
237 | + array_shift($target_list); | |
238 | + if (true === isset($this->virtual_role)) { | |
239 | + $role_list[] = $this->virtual_role; | |
241 | 240 | } |
242 | 241 | } |
243 | - $stack = ArrayFilter::GetArg($stack); | |
242 | + $target_list = ArrayFilter::GetArg($target_list); | |
244 | 243 | |
245 | - if (count($stack) > 1) { | |
246 | - return count(array_intersect($stack, $list)) > 0; | |
244 | + if (count($target_list) > 1) { | |
245 | + return count(array_intersect($target_list, $role_list)) > 0; | |
247 | 246 | } else { |
248 | - return in_array($stack[0], $list); | |
247 | + return in_array($target_list[0], $role_list); | |
249 | 248 | } |
250 | 249 | } |
251 | 250 | |
252 | 251 | //役職グループ判定 |
253 | - public function IsRoleGroup($role) { | |
254 | - $stack = func_get_args(); | |
252 | + public function IsRoleGroup(...$target_list) { | |
255 | 253 | $role_list = $this->role_list; |
256 | - if ($stack[0] === true) { //仮想役職対応 | |
257 | - array_shift($stack); | |
258 | - if (isset($this->virtual_role)) { | |
254 | + if (true === $target_list[0]) { //仮想役職対応 | |
255 | + array_shift($target_list); | |
256 | + if (true === isset($this->virtual_role)) { | |
259 | 257 | $role_list[] = $this->virtual_role; |
260 | 258 | } |
261 | 259 | } |
262 | - $stack = ArrayFilter::GetArg($stack); | |
260 | + $target_list = ArrayFilter::GetArg($target_list); | |
263 | 261 | |
264 | - foreach ($stack as $target) { | |
262 | + foreach ($target_list as $target) { | |
265 | 263 | foreach ($role_list as $role) { |
266 | - if (Text::Search($role, $target)) return true; | |
264 | + if (Text::Search($role, $target)) { | |
265 | + return true; | |
266 | + } | |
267 | 267 | } |
268 | 268 | } |
269 | 269 | return false; |
@@ -275,8 +275,8 @@ | ||
275 | 275 | } |
276 | 276 | |
277 | 277 | //生存 + 役職グループ判定 |
278 | - public function IsLiveRoleGroup($role) { | |
279 | - return $this->IsLive(true) && $this->IsRoleGroup(func_get_args()); | |
278 | + public function IsLiveRoleGroup(...$target_list) { | |
279 | + return $this->IsLive(true) && $this->IsRoleGroup($target_list); | |
280 | 280 | } |
281 | 281 | |
282 | 282 | //同一陣営判定 |
@@ -295,20 +295,28 @@ | ||
295 | 295 | } |
296 | 296 | |
297 | 297 | //同一役職系判定 |
298 | - public function IsMainGroup($group) { | |
299 | - $stack = func_get_args(); | |
300 | - return in_array($this->DistinguishRoleGroup(), $stack); | |
298 | + public function IsMainGroup(...$target_list) { | |
299 | + return in_array($this->DistinguishRoleGroup(), $target_list); | |
301 | 300 | } |
302 | 301 | |
303 | 302 | //拡張判定 |
304 | 303 | public function IsPartner($type, $target) { |
305 | 304 | $partner = $this->GetPartner($type); |
306 | - if (is_null($partner)) return false; | |
307 | - if (is_array($target)) { | |
308 | - if (! isset($target[$type])) return false; | |
305 | + if (true === is_null($partner)) { | |
306 | + return false; | |
307 | + } | |
308 | + | |
309 | + if (true === is_array($target)) { | |
310 | + if (true !== isset($target[$type])) { | |
311 | + return false; | |
312 | + } | |
313 | + | |
309 | 314 | $target_list = $target[$type]; |
310 | - if (! is_array($target_list)) return false; | |
311 | - return count(array_intersect($partner, $target_list)) > 0; | |
315 | + if (true === is_array($target_list)) { | |
316 | + return count(array_intersect($partner, $target_list)) > 0; | |
317 | + } else { | |
318 | + return false; | |
319 | + } | |
312 | 320 | } else { |
313 | 321 | return in_array($target, $partner); |
314 | 322 | } |
@@ -957,8 +965,7 @@ | ||
957 | 965 | } |
958 | 966 | |
959 | 967 | //役職の出現判定 |
960 | - public function IsAppear($role) { | |
961 | - $role_list = func_get_args(); | |
968 | + public function IsAppear(...$role_list) { | |
962 | 969 | return count(array_intersect($role_list, array_keys($this->role))) > 0; |
963 | 970 | } |
964 | 971 |