diff --git a/.phan/config.php b/.phan/config.php index 10f62842..f95c89d8 100644 --- a/.phan/config.php +++ b/.phan/config.php @@ -11,7 +11,8 @@ return [ // If this is set to null, // then Phan assumes the PHP version which is closest to the minor version // of the php executable used to execute phan. - "target_php_version" => null, + "target_php_version" => '7.0', + 'backward_compatibility_checks ' => false, 'file_list' => [ 'f_config/config.php', diff --git a/hwe/func.php b/hwe/func.php index fa0b599d..7f841a0e 100644 --- a/hwe/func.php +++ b/hwe/func.php @@ -163,7 +163,7 @@ function cityInfo() { $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $gen1 = MYDB_fetch_array($result); } else { - $gen1['name'] = '-'; + $gen1 = ['name'=>'-']; } if($city['gen2'] > 0) { @@ -171,7 +171,7 @@ function cityInfo() { $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $gen2 = MYDB_fetch_array($result); } else { - $gen2['name'] = '-'; + $gen2 = ['name'=>'-']; } if($city['gen3'] > 0) { @@ -179,7 +179,7 @@ function cityInfo() { $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $gen3 = MYDB_fetch_array($result); } else { - $gen3['name'] = '-'; + $gen3 = ['name'=>'-']; } echo " @@ -687,11 +687,7 @@ function CoreCommandTable() { addCommand("몰수", 24, $valid); commandGroup("", 1); commandGroup("====== 외 교 ======"); - if($citycount <= 4) { - addCommand("통합 제의", 53, $valid); - } else { - addCommand("통합 제의", 53, 0); - } + addCommand("통합 제의", 53, $valid); addCommand("항복 권고", 51, $valid); if($nation['level'] >= 2) { @@ -705,11 +701,7 @@ function CoreCommandTable() { addCommand("파기 제의", 64, $valid); commandGroup("", 1); commandGroup("====== 특 수 ======"); - if($citycount >= 5) { - addCommand("초토화", 65, $valid); - } else { - addCommand("초토화", 65, 0); - } + addCommand("초토화", 65, $valid); addCommand("천도/3턴(금쌀{$admin['develcost']}0)", 66, $valid); $cost = $admin['develcost'] * 500 + 60000; // 7만~13만 addCommand("증축/6턴(금쌀{$cost})", 67, $valid); @@ -1282,7 +1274,7 @@ function increaseRefresh($type="", $cnt=1) { file_put_contents( "logs/_{$date2}_refresh.txt", sprintf( - "%s, %s, %s, %s, %d\n", + "%s, %s, %s, %s, %s, %d\n", $date, $session->userName, $session->generalName, @@ -1455,6 +1447,7 @@ function checkDelay() { function updateOnline() { $db = DB::db(); $connect=$db->get(); + $nationname = []; //국가별 이름 매핑 foreach(getAllNationStaticInfo() as $nation) { @@ -1504,6 +1497,8 @@ function checkTurn() { $db = DB::db(); $connect=$db->get(); + $alllog = []; + // 잦은 갱신 금지 현재 5초당 1회 if(!timeover()) { return; } // 현재 처리중이면 접근 불가 @@ -1521,16 +1516,14 @@ function checkTurn() { $session = Session::getInstance(); - $locklog[0] = "- checkTurn() : ".date('Y-m-d H:i:s')." : ".$session->userName; - pushLockLog($locklog); + pushLockLog(["- checkTurn() : ".date('Y-m-d H:i:s')." : ".$session->userName]); // 파일락 해제 if(!flock($fp, LOCK_UN)) { return; } // 세마포어 해제 //if(!@sem_release($sema)) { echo "치명적 에러! 유기체에게 문의하세요!"; exit(1); } - $locklog[0] = "- checkTurn() 입 : ".date('Y-m-d H:i:s')." : ".$session->userName; - pushLockLog($locklog); + pushLockLog(["- checkTurn() 입 : ".date('Y-m-d H:i:s')." : ".$session->userName]); //if(STEP_LOG) delStepLog(); //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', 진입'); @@ -1595,8 +1588,7 @@ function checkTurn() { //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', preUpdateMonthly'); $result = preUpdateMonthly(); if($result == false) { - $locklog[0] = "-- checkTurn() 오류출 : ".date('Y-m-d H:i:s')." : ".$session->userName; - pushLockLog($locklog); + pushLockLog(["-- checkTurn() 오류출 : ".date('Y-m-d H:i:s')." : ".$session->userName]); // 잡금 해제 //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', unlock'); @@ -1608,8 +1600,7 @@ function checkTurn() { $dt = turnDate($nextTurn); $admin['year'] = $dt[0]; $admin['month'] = $dt[1]; - $locklog[0] = "-- checkTurn() ".$admin['month']."월 : ".date('Y-m-d H:i:s')." : ".$session->userName; - pushLockLog($locklog); + pushLockLog(["-- checkTurn() ".$admin['month']."월 : ".date('Y-m-d H:i:s')." : ".$session->userName]); // 이벤트 핸들러 동작 foreach (DB::db()->query('SELECT * from event') as $rawEvent) { @@ -1734,8 +1725,7 @@ function checkTurn() { //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', unlock'); unlock(); - $locklog[0] = "- checkTurn() 출 : ".date('Y-m-d H:i:s')." : ".$session->userName; - pushLockLog($locklog); + pushLockLog(["- checkTurn() 출 : ".date('Y-m-d H:i:s')." : ".$session->userName]); //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', finish'); @@ -1765,9 +1755,8 @@ function addAge() { $query = "update general set special='$special' where no='{$general['no']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $log[0] = "●특기 【".getGenSpecial($special)."】(을)를 익혔습니다!"; pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:특기 【".getGenSpecial($special)."】(을)를 습득"); - pushGenLog($general, $log); + pushGenLog($general, "●특기 【".getGenSpecial($special)."】(을)를 익혔습니다!"); } $query = "select no,name,nation,leader,power,intel,npc,dex0,dex10,dex20,dex30,dex40 from general where specage2<=age and special2='0'"; @@ -1781,9 +1770,8 @@ function addAge() { $query = "update general set special2='$special2' where no='{$general['no']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $log[0] = "●특기 【".getGenSpecial($special2)."】(을)를 익혔습니다!"; pushGeneralHistory($general, "●{$admin['year']}년 {$admin['month']}월:특기 【".getGenSpecial($special2)."】(을)를 습득"); - pushGenLog($general, $log); + pushGenLog($general, "●특기 【".getGenSpecial($special2)."】(을)를 익혔습니다!"); } } } @@ -1810,9 +1798,8 @@ function turnDate($curtime) { $query = "update game set year='$year',month='$month'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } - $value[0] = $year; - $value[1] = $month; - return $value; + + return [$year, $month]; } @@ -1836,6 +1823,7 @@ function triggerTournament() { function PreprocessCommand($no) { $db = DB::db(); $connect=$db->get(); + $log = []; $query = "select no,name,city,injury,special2,item,turn0 from general where no='$no'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); @@ -1849,8 +1837,7 @@ function PreprocessCommand($no) { $query = "update general set injury=0 where no='$no'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $log[0] = "의술을 펼쳐 스스로 치료합니다!"; - pushGenLog($general, $log); + pushGenLog($general, "의술을 펼쳐 스스로 치료합니다!"); } $query = "select no,name,injury from general where city='{$general['city']}' and injury>10 order by rand()"; @@ -1869,8 +1856,7 @@ function PreprocessCommand($no) { $query = "update general set injury=0 where no='{$patient['no']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $log[0] = "{$general['name']}(이)가 의술로써 치료해줍니다!"; - pushGenLog($patient, $log); + pushGenLog($patient, "{$general['name']}(이)가 의술로써 치료해줍니다!"); if($patientName == "") { $patientName = $patient['name']; @@ -1878,12 +1864,11 @@ function PreprocessCommand($no) { } if($patientCount == 1) { - $log[0] = "의술을 펼쳐 도시의 장수 {$patientName}(을)를 치료합니다!"; + pushGenLog($general, "의술을 펼쳐 도시의 장수 {$patientName}(을)를 치료합니다!"); } else { $patientCount -= 1; - $log[0] = "의술을 펼쳐 도시의 장수들 {$patientName} 외 {$patientCount}명을 치료합니다!"; + pushGenLog($general, "의술을 펼쳐 도시의 장수들 {$patientName} 외 {$patientCount}명을 치료합니다!"); } - pushGenLog($general, $log); } } @@ -1918,6 +1903,7 @@ function PreprocessCommand($no) { function updateTurntime($no) { $db = DB::db(); $connect=$db->get(); + $alllog = []; $query = "select year,month,isUnited,turnterm from game limit 1"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); @@ -2166,6 +2152,9 @@ function CheckHall($no) { function uniqueItem($general, $log, $vote=0) { $db = DB::db(); $connect=$db->get(); + $log = []; + $alllog = []; + $history = []; if($general['npc'] >= 2 || $general['betray'] > 1) { return $log; } if($general['weap'] > 6 || $general['book'] > 6 || $general['horse'] > 6 || $general['item'] > 6) { return $log; } @@ -2540,7 +2529,7 @@ function nextRuler($general) { * @param $distForm 리턴 타입. true일 경우 $result[$dist] = [...$city] 이며, false일 경우 $result[$city] = $dist 임 */ function searchDistance(int $from, int $maxDist=99, bool $distForm = false) { - $queue = new \SqlQueue(); + $queue = new \SplQueue(); $cities = []; $distanceList = []; diff --git a/hwe/func_command.php b/hwe/func_command.php index 4db7e281..6469e9a1 100644 --- a/hwe/func_command.php +++ b/hwe/func_command.php @@ -2,6 +2,7 @@ namespace sammo; function getTurn($general, $type, $font=1) { + $str = []; $db = DB::db(); $connect=$db->get(); @@ -256,6 +257,7 @@ function getTurn($general, $type, $font=1) { function getCoreTurn($nation, $level) { $db = DB::db(); $connect=$db->get(); + $str = []; $turn[0] = $nation["l{$level}turn0"]; $turn[1] = $nation["l{$level}turn1"]; diff --git a/hwe/func_process_trick.php b/hwe/func_process_trick.php index f51fe1fa..2e4e6e47 100644 --- a/hwe/func_process_trick.php +++ b/hwe/func_process_trick.php @@ -1,5 +1,6 @@ {$disastername}"; + $disaster = []; //재해 처리 if(count($disastercity)) { @@ -606,19 +607,19 @@ function disaster() { case 1: switch($disastertype) { case 0: - $disaster[count($disaster)] = "●{$admin['year']}년 {$admin['month']}월:【재난】{$disastername}에 역병이 발생하여 도시가 황폐해지고 있습니다."; + $disaster[] = "●{$admin['year']}년 {$admin['month']}월:【재난】{$disastername}에 역병이 발생하여 도시가 황폐해지고 있습니다."; $state = 4; break; case 1: - $disaster[count($disaster)] = "●{$admin['year']}년 {$admin['month']}월:【재난】{$disastername}에 지진으로 피해가 속출하고 있습니다."; + $disaster[] = "●{$admin['year']}년 {$admin['month']}월:【재난】{$disastername}에 지진으로 피해가 속출하고 있습니다."; $state = 5; break; case 2: - $disaster[count($disaster)] = "●{$admin['year']}년 {$admin['month']}월:【재난】{$disastername}에 추위가 풀리지 않아 얼어죽는 백성들이 늘어나고 있습니다."; + $disaster[] = "●{$admin['year']}년 {$admin['month']}월:【재난】{$disastername}에 추위가 풀리지 않아 얼어죽는 백성들이 늘어나고 있습니다."; $state = 3; break; case 3: - $disaster[count($disaster)] = "●{$admin['year']}년 {$admin['month']}월:【재난】{$disastername}에 황건적이 출현해 도시를 습격하고 있습니다."; + $disaster[] = "●{$admin['year']}년 {$admin['month']}월:【재난】{$disastername}에 황건적이 출현해 도시를 습격하고 있습니다."; $state = 9; break; } @@ -627,19 +628,19 @@ function disaster() { case 4: switch($disastertype) { case 0: - $disaster[count($disaster)] = "●{$admin['year']}년 {$admin['month']}월:【재난】{$disastername}에 홍수로 인해 피해가 급증하고 있습니다."; + $disaster[] = "●{$admin['year']}년 {$admin['month']}월:【재난】{$disastername}에 홍수로 인해 피해가 급증하고 있습니다."; $state = 7; break; case 1: - $disaster[count($disaster)] = "●{$admin['year']}년 {$admin['month']}월:【재난】{$disastername}에 지진으로 피해가 속출하고 있습니다."; + $disaster[] = "●{$admin['year']}년 {$admin['month']}월:【재난】{$disastername}에 지진으로 피해가 속출하고 있습니다."; $state = 5; break; case 2: - $disaster[count($disaster)] = "●{$admin['year']}년 {$admin['month']}월:【재난】{$disastername}에 태풍으로 인해 피해가 속출하고 있습니다."; + $disaster[] = "●{$admin['year']}년 {$admin['month']}월:【재난】{$disastername}에 태풍으로 인해 피해가 속출하고 있습니다."; $state = 6; break; case 3: - $disaster[count($disaster)] = "●{$admin['year']}년 {$admin['month']}월:【호황】{$disastername}에 호황으로 도시가 번창하고 있습니다."; + $disaster[] = "●{$admin['year']}년 {$admin['month']}월:【호황】{$disastername}에 호황으로 도시가 번창하고 있습니다."; $state = 2; $isGood = 1; break; @@ -649,19 +650,19 @@ function disaster() { case 7: switch($disastertype) { case 0: - $disaster[count($disaster)] = "●{$admin['year']}년 {$admin['month']}월:【재난】{$disastername}에 메뚜기 떼가 발생하여 도시가 황폐해지고 있습니다."; + $disaster[] = "●{$admin['year']}년 {$admin['month']}월:【재난】{$disastername}에 메뚜기 떼가 발생하여 도시가 황폐해지고 있습니다."; $state = 8; break; case 1: - $disaster[count($disaster)] = "●{$admin['year']}년 {$admin['month']}월:【재난】{$disastername}에 지진으로 피해가 속출하고 있습니다."; + $disaster[] = "●{$admin['year']}년 {$admin['month']}월:【재난】{$disastername}에 지진으로 피해가 속출하고 있습니다."; $state = 5; break; case 2: - $disaster[count($disaster)] = "●{$admin['year']}년 {$admin['month']}월:【재난】{$disastername}에 흉년이 들어 굶어죽는 백성들이 늘어나고 있습니다."; + $disaster[] = "●{$admin['year']}년 {$admin['month']}월:【재난】{$disastername}에 흉년이 들어 굶어죽는 백성들이 늘어나고 있습니다."; $state = 8; break; case 3: - $disaster[count($disaster)] = "●{$admin['year']}년 {$admin['month']}월:【풍작】{$disastername}에 풍작으로 도시가 번창하고 있습니다."; + $disaster[] = "●{$admin['year']}년 {$admin['month']}월:【풍작】{$disastername}에 풍작으로 도시가 번창하고 있습니다."; $state = 1; $isGood = 1; break; @@ -671,19 +672,19 @@ function disaster() { case 10: switch($disastertype) { case 0: - $disaster[count($disaster)] = "●{$admin['year']}년 {$admin['month']}월:【재난】{$disastername}에 혹한으로 도시가 황폐해지고 있습니다."; + $disaster[] = "●{$admin['year']}년 {$admin['month']}월:【재난】{$disastername}에 혹한으로 도시가 황폐해지고 있습니다."; $state = 3; break; case 1: - $disaster[count($disaster)] = "●{$admin['year']}년 {$admin['month']}월:【재난】{$disastername}에 지진으로 피해가 속출하고 있습니다."; + $disaster[] = "●{$admin['year']}년 {$admin['month']}월:【재난】{$disastername}에 지진으로 피해가 속출하고 있습니다."; $state = 5; break; case 2: - $disaster[count($disaster)] = "●{$admin['year']}년 {$admin['month']}월:【재난】{$disastername}에 눈이 많이 쌓여 도시가 황폐해지고 있습니다."; + $disaster[] = "●{$admin['year']}년 {$admin['month']}월:【재난】{$disastername}에 눈이 많이 쌓여 도시가 황폐해지고 있습니다."; $state = 3; break; case 3: - $disaster[count($disaster)] = "●{$admin['year']}년 {$admin['month']}월:【재난】{$disastername}에 황건적이 출현해 도시를 습격하고 있습니다."; + $disaster[] = "●{$admin['year']}년 {$admin['month']}월:【재난】{$disastername}에 황건적이 출현해 도시를 습격하고 있습니다."; $state = 9; break; } diff --git a/hwe/func_tournament.php b/hwe/func_tournament.php index ea97b963..f40bf7ad 100644 --- a/hwe/func_tournament.php +++ b/hwe/func_tournament.php @@ -261,11 +261,12 @@ function startTournament($auto, $type) { $query = "truncate tournament"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); + $history = []; switch($type) { - case 0: $history[0] = "◆{$admin['year']}년 {$admin['month']}월: 전력전 대회가 개최됩니다! 천하의 영웅들을 모집하고 있습니다!"; break; - case 1: $history[0] = "◆{$admin['year']}년 {$admin['month']}월: 통솔전 대회가 개최됩니다! 천하의 명사들을 모집하고 있습니다!"; break; - case 2: $history[0] = "◆{$admin['year']}년 {$admin['month']}월: 일기토 대회가 개최됩니다! 천하의 용사들을 모집하고 있습니다!"; break; - case 3: $history[0] = "◆{$admin['year']}년 {$admin['month']}월: 설전 대회가 개최됩니다! 천하의 책사들을 모집하고 있습니다!"; break; + case 0: $history[] = "◆{$admin['year']}년 {$admin['month']}월: 전력전 대회가 개최됩니다! 천하의 영웅들을 모집하고 있습니다!"; break; + case 1: $history[] = "◆{$admin['year']}년 {$admin['month']}월: 통솔전 대회가 개최됩니다! 천하의 명사들을 모집하고 있습니다!"; break; + case 2: $history[] = "◆{$admin['year']}년 {$admin['month']}월: 일기토 대회가 개최됩니다! 천하의 용사들을 모집하고 있습니다!"; break; + case 3: $history[] = "◆{$admin['year']}년 {$admin['month']}월: 설전 대회가 개최됩니다! 천하의 책사들을 모집하고 있습니다!"; break; } pushWorldHistory($history, $admin['year'], $admin['month']); } @@ -343,6 +344,7 @@ function fillLowGenAll() { //8 4강 //9 결승 function getTwo($tournament, $phase) { + $cand = []; switch($tournament) { case 2: //예선 @@ -746,6 +748,7 @@ function getLog($lvl1, $lvl2) { //0 : 승무패, 1 : 승패 function fight($tnmt_type, $tnmt, $phs, $group, $g1, $g2, $type) { + $log = []; $db = DB::db(); $connect=$db->get(); diff --git a/hwe/sammo/CityHelper.php b/hwe/sammo/CityHelper.php index 14f5df72..c234f9f6 100644 --- a/hwe/sammo/CityHelper.php +++ b/hwe/sammo/CityHelper.php @@ -39,6 +39,9 @@ class CityHelper{ self::$listByNation = $listByNation; } + /** + * @return array[] + */ public static function getAllCities(){ if(self::$list === null){ self::generateCache(); diff --git a/hwe/sammo/Event/Action/RaiseInvader.php b/hwe/sammo/Event/Action/RaiseInvader.php index c76ced4a..aff8b8c3 100644 --- a/hwe/sammo/Event/Action/RaiseInvader.php +++ b/hwe/sammo/Event/Action/RaiseInvader.php @@ -1,6 +1,5 @@ npc = new \sammo\Scenario\NPC( $affinity, diff --git a/hwe/sammo/Event/Condition.php b/hwe/sammo/Event/Condition.php index 05838684..f9c2e2e5 100644 --- a/hwe/sammo/Event/Condition.php +++ b/hwe/sammo/Event/Condition.php @@ -36,7 +36,11 @@ abstract class Condition{ } //array의 첫번째 값이 Condition이 아닌 경우에는 그냥 배열로 처리함. - return array_map(static::build, $conditionChain); + $result = []; + foreach($conditionChain as $condition){ + $result[] = static::build($condition); + } + return $result; } protected static function _eval($arg, $env=null){ @@ -47,7 +51,7 @@ abstract class Condition{ ]; } if($arg instanceof Condition){ - return $arg->checkCondition($env); + return $arg->eval($env); } throw new \InvalidArgumentException('평가 인자는 boolean이거나 Condition 클래스여야 합니다.'); } diff --git a/hwe/sammo/Event/Condition/Interval.php b/hwe/sammo/Event/Condition/Interval.php index b15c56ac..21e2e6ef 100644 --- a/hwe/sammo/Event/Condition/Interval.php +++ b/hwe/sammo/Event/Condition/Interval.php @@ -1,7 +1,7 @@ false, @@ -26,7 +28,7 @@ class Logic extends \sammo\Event\Condition{ } public function eval($env=null){ - switch($this->$mode){ + switch($this->mode){ case 'not': return $this->logicNot($env); case 'and': @@ -41,7 +43,7 @@ class Logic extends \sammo\Event\Condition{ } private function logicNot($env){ - $sub = self::_eval($this->conditions[0], $env); + $result = self::_eval($this->conditions[0], $env); $result['value'] = !$result['value']; $result['chain'][] = 'not'; return $result; @@ -55,7 +57,7 @@ class Logic extends \sammo\Event\Condition{ $sub = self::_eval($cond, $env); $chain[] = $sub['chain']; if(!$sub['value']){ - $result['value'] = false; + $value = false; break; } } @@ -74,7 +76,7 @@ class Logic extends \sammo\Event\Condition{ $sub = self::_eval($cond, $env); $chain[] = $sub['chain']; if($sub['value']){ - $result['value'] = true; + $value = true; break; } } diff --git a/hwe/sammo/GameUnitConst.php b/hwe/sammo/GameUnitConst.php index 239ea082..aad1bf30 100644 --- a/hwe/sammo/GameUnitConst.php +++ b/hwe/sammo/GameUnitConst.php @@ -18,22 +18,23 @@ class GameUnitConst{ static::_generate(); return static::$constID; } - public static function byID($id): GameUnitDetail{ + + public static function byID(int $id): GameUnitDetail{ static::_generate(); return static::$constID[$id]; } - public static function byName($name): GameUnitDetail{ + public static function byName(string $name): GameUnitDetail{ static::_generate(); return static::$constName[$name]; } - public static function byCity($city): GameUnitDetail{ + public static function byCity(int $city): GameUnitDetail{ static::_generate(); return static::$constCity[$city]; } - public static function byRegion($region): GameUnitDetail{ + public static function byRegion(int $region): GameUnitDetail{ static::_generate(); return static::$constRegion[$region]; } diff --git a/hwe/sammo/GameUnitDetail.php b/hwe/sammo/GameUnitDetail.php index 215f48de..5a7688b3 100644 --- a/hwe/sammo/GameUnitDetail.php +++ b/hwe/sammo/GameUnitDetail.php @@ -13,6 +13,7 @@ class GameUnitDetail{ public $recruitType; public $recruitCondition; public $recruitFirst; + public $info; public function __construct( int $id, @@ -62,7 +63,7 @@ class GameUnitDetail{ } if($this->recruitType == 2){ - $cityLevel = CityConst::byID($id)->level; + $cityLevel = CityConst::byID($this->id)->level; $cityLevel = CityConst::$regionMap[$cityLevel]; if(!key_exists($this->recruitCondition, $ownCities)){ diff --git a/hwe/sammo/Scenario/NPC.php b/hwe/sammo/Scenario/NPC.php index 629cfce9..948c8909 100644 --- a/hwe/sammo/Scenario/NPC.php +++ b/hwe/sammo/Scenario/NPC.php @@ -97,6 +97,7 @@ class NPC{ $name = 'ⓝ'.$this->name; + $pictureID = $this->pictureID; if($env['show_img_level'] == 3 && $pictureID > 0){ $picture = "{$pictureID}.jpg"; } @@ -107,11 +108,13 @@ class NPC{ $city = $this->locatedCity; if($city === null){ if($nationID == 0){ - $city = Util::choiceRandom(CityHelper::getAllCities())['id']; + $cityObj = Util::choiceRandom(CityHelper::getAllCities()); } else{ - $city = Util::choiceRandom(CityHelper::getAllNationCities($nationID))['id']; + $cityObj = Util::choiceRandom(CityHelper::getAllNationCities($nationID)); } + '@phan-var array $cityObj'; + $city = $cityObj['id']; } $experience = $age * 100; diff --git a/hwe/sammo/Scenario/Nation.php b/hwe/sammo/Scenario/Nation.php index d6a3231f..10616141 100644 --- a/hwe/sammo/Scenario/Nation.php +++ b/hwe/sammo/Scenario/Nation.php @@ -1,7 +1,6 @@ type = $type; $this->nationLevel = $nationLevel; $this->cities = $cities; - - $this->capital = count($cities)>0?$cities[0]:null; + + if(count($cities)){ + $this->capital = $this->cities[0]; + } } public function setID(int $id){ diff --git a/src/kakao/Kakao_REST_API_Helper.php b/src/kakao/Kakao_REST_API_Helper.php index 3cf41360..7e568cc9 100644 --- a/src/kakao/Kakao_REST_API_Helper.php +++ b/src/kakao/Kakao_REST_API_Helper.php @@ -2,6 +2,7 @@ namespace kakao; if (class_exists('\\kakao\\KakaoKey') === false) { + /** @suppress PhanRedefineClass */ class KakaoKey { const REST_KEY = ''; @@ -106,12 +107,12 @@ class Kakao_REST_API_Helper if ($api_path != '/oauth/token') { if (in_array($api_path, self::$admin_apis)) { if (!$this->admin_key) { - throw new Exception('admin key should not be null or empty.'); + throw new \Exception('admin key should not be null or empty.'); } $headers = array('Authorization: KakaoAK ' . $this->admin_key); } else { if (!$this->access_token) { - throw new Exception('access token should not be null or empty.'); + throw new \Exception('access token should not be null or empty.'); } $headers = array('Authorization: Bearer ' . $this->access_token); } @@ -134,7 +135,7 @@ class Kakao_REST_API_Helper $return_data = curl_exec($curl_session); if (curl_errno($curl_session)) { - throw new Exception(curl_error($curl_session)); + throw new \Exception(curl_error($curl_session)); } else { // 디버깅 시에 주석을 풀고 응답 내용 확인할 때 //print_r(curl_getinfo($curl_session)); diff --git a/src/sammo/AppConf.php b/src/sammo/AppConf.php index 25ff29f3..f1498218 100644 --- a/src/sammo/AppConf.php +++ b/src/sammo/AppConf.php @@ -32,8 +32,10 @@ class AppConf public static function requireRootDB() { if (!class_exists('\\sammo\\RootDB')) { - trigger_error('RootDB.php가 설정되지 않았습니다.', E_USER_ERROR); - die(); + if(!trigger_error('RootDB.php가 설정되지 않았습니다.', E_USER_ERROR)){ + die(); + } + } return RootDB::db(); } @@ -46,8 +48,10 @@ class AppConf public static function requireDB() { if (!class_exists('\\sammo\\DB')) { - trigger_error('DB.php가 설정되지 않았습니다.', E_USER_ERROR); - die(); + if(!trigger_error('DB.php가 설정되지 않았습니다.', E_USER_ERROR)){ + die(); + } + } return DB::db(); } diff --git a/src/sammo/FileUtil.php b/src/sammo/FileUtil.php index 519f1a0d..eaa25153 100644 --- a/src/sammo/FileUtil.php +++ b/src/sammo/FileUtil.php @@ -40,7 +40,7 @@ class FileUtil $filepath = sprintf('%s/%s', $dir, $FolderOrFile); if (is_dir($filepath)) { - delExpiredInDir($filepath, $t); + static::delExpiredInDir($filepath, $t); } // recursive else { $mt = filemtime($filepath); @@ -51,7 +51,6 @@ class FileUtil } closedir($handle); } - - return $success; + } } diff --git a/vendor/brandonwamboldt/utilphp/src/utilphp/util.php b/vendor/brandonwamboldt/utilphp/src/utilphp/util.php index 0932d7d1..9be380ae 100644 --- a/vendor/brandonwamboldt/utilphp/src/utilphp/util.php +++ b/vendor/brandonwamboldt/utilphp/src/utilphp/util.php @@ -282,7 +282,7 @@ class util * concisely access an index which may or may not exist without * raising a warning. * - * @param array $var Array value to access + * @param mixed $var Array value to access * @param mixed $default Default value to return if the key is not * present in the array * @return mixed