agentid = Utils::arrayGet($arr, "agentid"); $agent->name = Utils::arrayGet($arr, "name"); $agent->square_logo_url = Utils::arrayGet($arr, "square_logo_url"); $agent->description = Utils::arrayGet($arr, "description"); $agent->close = Utils::arrayGet($arr, "close"); $agent->redirect_domain = Utils::arrayGet($arr, "redirect_domain"); $agent->report_location_flag = Utils::arrayGet($arr, "report_location_flag"); $agent->isreportenter = Utils::arrayGet($arr, "isreportenter"); $agent->home_url = Utils::arrayGet($arr, "home_url"); if (array_key_exists("allow_userinfos", $arr) && array_key_exists("user", $arr["allow_userinfos"])) { $userArr = $arr["allow_userinfos"]["user"]; foreach($userArr as $item) { $agent->allow_userinfos[] = $item["userid"]; } } if (array_key_exists("allow_partys", $arr)) { $partyAr = $arr["allow_partys"]; $agent->allow_partys = Utils::arrayGet($partyAr, "partyid"); } if (array_key_exists("allow_tags", $arr)) { $tagArr= $arr["allow_tags"]; $agent->allow_tags= Utils::arrayGet($tagArr, "tagid"); } return $agent; } public static function Array2AgentList($arr) { $agentLIst = array(); foreach($arr["agentlist"] as $item) { $agent = self::Array2Agent($item); $agentLIst[] = $agent; } return $agentLIst; } public static function Agent2Array($agent) { $args = array(); Utils::setIfNotNull($agent->agentid, "agentid", $args); Utils::setIfNotNull($agent->name, "name", $args); Utils::setIfNotNull($agent->square_logo_url, "square_logo_url", $args); Utils::setIfNotNull($agent->description, "description", $args); Utils::setIfNotNull($agent->close, "close", $args); Utils::setIfNotNull($agent->redirect_domain, "redirect_domain", $args); Utils::setIfNotNull($agent->report_location_flag, "report_location_flag", $args); Utils::setIfNotNull($agent->isreportenter, "isreportenter", $args); Utils::setIfNotNull($agent->home_url, "home_url", $args); return $args; } public static function CheckAgentSetArgs($agent) { utils::checkIsUInt($agent->agentid, "agentid"); } }