• R/O
  • SSH
  • HTTPS

jinrousiki: コミット


コミットメタ情報

リビジョン2112 (tree)
日時2018-01-03 22:03:05
作者umethyl

ログメッセージ

User: func_get_args() 廃止

変更サマリ

差分

--- trunk/include/user_class.php (revision 2111)
+++ trunk/include/user_class.php (revision 2112)
@@ -231,39 +231,39 @@
231231 }
232232
233233 //役職判定
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;
241240 }
242241 }
243- $stack = ArrayFilter::GetArg($stack);
242+ $target_list = ArrayFilter::GetArg($target_list);
244243
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;
247246 } else {
248- return in_array($stack[0], $list);
247+ return in_array($target_list[0], $role_list);
249248 }
250249 }
251250
252251 //役職グループ判定
253- public function IsRoleGroup($role) {
254- $stack = func_get_args();
252+ public function IsRoleGroup(...$target_list) {
255253 $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)) {
259257 $role_list[] = $this->virtual_role;
260258 }
261259 }
262- $stack = ArrayFilter::GetArg($stack);
260+ $target_list = ArrayFilter::GetArg($target_list);
263261
264- foreach ($stack as $target) {
262+ foreach ($target_list as $target) {
265263 foreach ($role_list as $role) {
266- if (Text::Search($role, $target)) return true;
264+ if (Text::Search($role, $target)) {
265+ return true;
266+ }
267267 }
268268 }
269269 return false;
@@ -275,8 +275,8 @@
275275 }
276276
277277 //生存 + 役職グループ判定
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);
280280 }
281281
282282 //同一陣営判定
@@ -295,20 +295,28 @@
295295 }
296296
297297 //同一役職系判定
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);
301300 }
302301
303302 //拡張判定
304303 public function IsPartner($type, $target) {
305304 $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+
309314 $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+ }
312320 } else {
313321 return in_array($target, $partner);
314322 }
@@ -957,8 +965,7 @@
957965 }
958966
959967 //役職の出現判定
960- public function IsAppear($role) {
961- $role_list = func_get_args();
968+ public function IsAppear(...$role_list) {
962969 return count(array_intersect($role_list, array_keys($this->role))) > 0;
963970 }
964971
旧リポジトリブラウザで表示