Get the POST fields for the token request.

@param string $code
@return array
355719
protected function getTokenFields(string $code)
    {
        return [
            'client_id' => $this->clientId,
            'client_secret' => $this->clientSecret,
            'code' => $code,
            'redirect_uri' => $this->redirectUrl,
        ];
    }
366722
public function get_string_from_code($code) {
		$errors = [
			self::ERR_GENERAL => 'General Error',
			self::ERR_BAD_REQUEST => 'Bad Request',
			self::ERR_UNAUTHORIZED => 'Unauthorized',
			self::ERR_FORBIDDEN => 'Forbidden',
			self::ERR_INTERNAL_ERROR => 'Internal Error',
			self::ERR_PRECONDITION_FAILED => 'Precondition Failed',
			self::ERR_RESOURCE_NOT_FOUND => 'Resource Not Found',
			self::ERR_INVALID_RESOURCE => 'Invalid Resource',
			self::ERR_NOT_IMPLEMENTED => 'Feature not implemented',
			self::ERR_DISABLED => 'Feature Disabled',
			self::ERR_NETWORKING_DISABLED => 'Networking is Disabled',
		];

		return (isset($errors[$code])) ? $errors[$code] : '';
	}
1043591
public function getAuthorizationCode($code)
    {
        $code = $this->collection('code_table')->findOne(array(
            'authorization_code' => $code
        ));
        return is_null($code) ? false : $code;
    }
304090
public function getAccessTokenResponse(string $code)
    {
        $response = $this->getHttpClient()->post($this->getTokenUrl(), [
            'headers' => ['Accept' => 'application/json'],
            'form_params' => $this->getTokenFields($code),
        ]);
        return json_decode($response->getBody(), true);
    }
624610
public static function getTokensFromString($code) {
      try {
        $tokens = token_get_all($code, TOKEN_PARSE);
      } catch (\ParseError $e) {
        // with TOKEN_PARSE flag, the function throws on invalid code
        // let's just ignore the error and tokenize the code without the flag
        $tokens = token_get_all($code);
      }

      foreach ($tokens as $index => $tokenData) {

        if (!is_array($tokenData)) {
          $previousIndex = $index - 1;

          /** @var Token $previousToken */
          $previousToken = $tokens[$previousIndex];
          $line = $previousToken->getLine() + substr_count($previousToken->getValue(), "\n");
          $tokenData = [
            Token::INVALID_TYPE,
            $tokenData,
            $line,
          ];
        }

        $token = new Token($tokenData);
        $token->setIndex($index);
        $tokens[$index] = $token;

      }

      return $tokens;
    }
120909
public function create(string $code): array
    {
        $stmt = $this->parser->parse($code);
        return $this->traverser->traverse($stmt);
    }
661054
public function getLocaleByCode($code)
    {
        $locales = $this->getLocales();
        if (array_key_exists($code, $locales)) {
            return $locales[$code];
        }
    }
563481
public function getAuthorizationCode($code)
    {
        $result = $this->client->getItem(array(
            "TableName"=> $this->config['code_table'],
            "Key" => array('authorization_code'   => array('S' => $code))
        ));
        if ($result->count()==0) {
            return false ;
        }
        $token = $this->dynamo2array($result);
        if (!array_key_exists("id_token", $token )) {
            $token['id_token'] = null;
        }
        $token['expires'] = strtotime($token['expires']);

        return $token;

    }
193029
public function get($code) {
		if (!$this->responses->has($code)) {
			$this->responses->set($code, new Response($code));
		}

		return $this->responses->get($code);
	}
274930
public function getAttribute( $code )
	{
		$map = $this->_getAttributeMap();

		if( isset( $map[ $code ] ) ) {
			return $map[ $code ]->getValue();
		}

		return null;
	}
1165822
public function getTransactionsByCode($code)
    {
        $this->_library->setEnvironment();
        $this->_library->setCharset();
        $this->_library->setLog();

        $response = null;
        try {
            $response = \PagSeguro\Services\Transactions\Search\Code::search(
                $this->_library->getPagSeguroCredentials(),
                $code
            );

            return $response;
        } catch (Exception $e) {
            throw new Exception($e->getMessage());
        }
    }
841416
protected function UserGetGroupIdByCode($code)
    {
        $rsGroups = CGroup::GetList(($by = 'c_sort'), ($order = 'desc'), [
            'STRING_ID' => $code,
        ]);
        if ($ob = $rsGroups->Fetch()) {
            return $ob['ID'];
        } else {
            return null;
        }
    }
812316
public function fetchAccessTokenFromCode($code = null)
    {
        if ($code === null) {
            if (!isset($_GET['code'])) {
                throw new LogicException("A parameter code is not set.");
            }

            $code = $_GET['code'];
        }

        $url = $this->getAccessTokenUrl();
        $parameter = array(
            'grant_type'    => 'authorization_code',
            'client_id'     => $this->developerId,
            'client_secret' => $this->secret,
            'code'          => $code,
            'redirect_uri'  => $this->redirectUrl
        );

        $response = $this->httpClient->post(
            $url,
            $parameter
        );

        if ($response->getCode() == 200) {
            $this->accessTokenInfo = json_decode($response->getContents(), true);
            if (isset($this->accessTokenInfo['access_token'])) {
                $this->accessToken = $this->accessTokenInfo['access_token'];

                return $this->accessToken;
            }
        }

        return null;
    }
373610
public function get(string $postcode)
    {
        $url = $this->getBaseUrl() . rawurlencode($postcode) . '?' . http_build_query([
            'api_key' => $this->getKey()
        ]);
        $request = $this->messageFactory->createRequest(
            'GET',
            $url,
            [],
            null,
            '1.1'
        );
        $response = $this->client->sendRequest($request);
        if ($response->getStatusCode() == 402) {
            throw new PaymentRequired;
        }
        if ($response->getStatusCode() == 404) {
            throw new PostcodeNotFound;
        }
        $data = json_decode($response->getBody()->getContents(), true);
        return $data;
    }
1188498
final public function get($code = null) {

        if ( is_null($code) ) return $this->rpc_errors;

        else if ( array_key_exists($code, $this->rpc_errors) ) return $this->rpc_errors[$code];

        else if ( $code >= -32099 && $code <= -32000 ) return 'Server Error';

        else return 'Unknown Error';

    }
955721
public function getAccessToken($code = null) {
        if ($this->debug) { $start = microtime(true); }
        if ($code) {
            // todo get access_token via authorization_code request
            $params['client_id']     = $this->getClientID();
            $params['client_secret'] = $this->getClientSecret();
            $params['redirect_uri']  = $this->getRedirectUri();
            $params['grant_type']    = 'authorization_code';
            $params['scope']         = '';
            $params['state']         = '';
            $params['code']          = $code;
            $access_token = (array) json_decode($this->makeRequest($this->getTokenURL(), $params));
        } else {
            if ($this->accessToken) {
                return $this->accessToken;
            } else {
                $session = $this->getSession();
                // either user session signed, or app signed
                if (isset($session['access_token'])) {
                    $access_token = $session['access_token'];
                } else {
                    // No success! Defaults to
                    $access_token = $this->getClientID();
                }
            }
        }
        if ($this->debug) { $this->timer[__FUNCTION__]['elapsed'][] = microtime(true)-$start; }
        return $access_token;
    }
275000
protected function getTokenBaseFields(string $code)
    {
        return [
            'client_id'     => $this->clientId,
            'client_secret' => $this->clientSecret,
            'code'          => $code,
            'redirect_uri'  => $this->callbackUrl,
        ];
    }