array_merge 대신 + 기호로 충분한 경우(dictionary) +로 변경함.

This commit is contained in:
2018-04-07 18:30:23 +09:00
parent 3d06a13e72
commit cff76c9db9
7 changed files with 11 additions and 13 deletions
+1 -3
View File
@@ -1613,9 +1613,7 @@ function checkTurn() {
$action = Json::decode($rawEvent['action']); $action = Json::decode($rawEvent['action']);
$event = new Event\EventHandler($cond, $action); $event = new Event\EventHandler($cond, $action);
$event->tryRunEvent(array_merge([ $event->tryRunEvent(['currentEventID'=>$eventID] + $admin);
'currentEventID'=>$eventID
], $admin));
} }
// 분기계산. 장수들 턴보다 먼저 있다면 먼저처리 // 분기계산. 장수들 턴보다 먼저 있다면 먼저처리
+1 -1
View File
@@ -13,7 +13,7 @@ $defaultPost = [
'neutralView' => false, 'neutralView' => false,
'showMe' => true 'showMe' => true
]; ];
$post = array_merge($defaultPost, WebUtil::parseJsonPost()); $post = WebUtil::parseJsonPost() + $defaultPost;
if(!$session->isLoggedIn() || !$session->generalID){ if(!$session->isLoggedIn() || !$session->generalID){
$post['neutralView'] = true; $post['neutralView'] = true;
+1 -1
View File
@@ -4,7 +4,7 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
$v = new Validator(array_merge($_POST, $_GET)); $v = new Validator($_GET + $_POST);
$v $v
->rule('required', [ ->rule('required', [
'name', 'name',
+2 -2
View File
@@ -323,7 +323,7 @@ class CityConst{
$queries = array_map(function(CityInitialDetail $city){ $queries = array_map(function(CityInitialDetail $city){
$initValue = static::$buildInit[$city->level]; $initValue = static::$buildInit[$city->level];
$path = join('|', array_keys($city->path)); $path = join('|', array_keys($city->path));
return array_merge(static::$buildInitCommon, $initValue, [ return [
'city'=>$city->id, 'city'=>$city->id,
'name'=>$city->name, 'name'=>$city->name,
'level'=>$city->level, 'level'=>$city->level,
@@ -335,7 +335,7 @@ class CityConst{
'def2'=>$city->defence, 'def2'=>$city->defence,
'wall2'=>$city->wall, 'wall2'=>$city->wall,
'region'=>$city->region 'region'=>$city->region
]); ] + $initValue + static::$buildInitCommon;
}, array_values(static::$constID)); }, array_values(static::$constID));
DB::db()->insert('city', $queries); DB::db()->insert('city', $queries);
+2 -2
View File
@@ -70,12 +70,12 @@ foreach (AppConf::getList() as $setting) {
]; ];
} }
$state = array_merge($state, [ $state += [
'name' => $serverDir, 'name' => $serverDir,
'korName' => $serverKorName, 'korName' => $serverKorName,
'color' => $serverColor, 'color' => $serverColor,
'isRoot' => $serverDir == $rootServer 'isRoot' => $serverDir == $rootServer
]); ];
$server[] = $state; $server[] = $state;
} }
+1 -1
View File
@@ -26,7 +26,7 @@ if($session->userGrade < 6){
]); ]);
} }
$request = array_merge($_POST, $_GET); $request = $_GET + $_POST;
$tmpFile = 'd_log/arc.zip'; $tmpFile = 'd_log/arc.zip';
+3 -3
View File
@@ -64,11 +64,11 @@ class Session
'reason'=>'로그인이 필요합니다.' 'reason'=>'로그인이 필요합니다.'
]; ];
if (is_array($result)) { if (!is_array($result)) {
$jsonResult = array_merge($jsonResult, $result); Json::die($jsonResult);
} }
Json::die($jsonResult); Json::die($result + $jsonResult);
} }
public static function requireLogin($result = '..'): Session public static function requireLogin($result = '..'): Session