protected function buildParams($params) { if (empty($params['access_token'])) { if (!empty($this->_accessToken)) { $params['access_token'] = $this->_accessToken; } elseif (class_exists('FB')) { $params['access_token'] = \FB::getAccessToken(); } } foreach ($params as $k => $v) { // Skip some special fields if (false !== array_search($k, array('connection', 'connection_scope'))) { unset($params[$k]); continue; } # NOTE: allow "key=false" in params (ex. for test user creation, it supports "installed=false") if (empty($v) && $v !== false) { continue; } // No need to modify strings and numbers if (is_string($v) || is_numeric($v)) { continue; } // Default encode it with JSON $params[$k] = json_encode($v); } return $params; }