'POST', 'headers' => array( 'Content-Type' => 'application/json', ), 'body' => $body, 'timeout' => 10, // seconds. ); if ( ! $ignore_auth ) { $access_token = fa_api_settings()->current_access_token(); $args['headers']['authorization'] = "Bearer $access_token"; } $response = $this->post( FONTAWESOME_API_URL, $args ); if ( $response instanceof WP_Error ) { // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped throw ApiRequestException::with_wp_error( add_failed_request_diagnostics( $response ) ); } if ( 200 === $response['response']['code'] ) { return $response['body']; } else { // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped throw ApiResponseException::with_wp_response( $response ); } } } // phpcs:disable Universal.Files.SeparateFunctionsFromOO.Mixed /** * Convenience global function to get a singleton instance of the Metadata Provider. * * Internal use only. Not part of this plugin's public API. * * @see FontAwesome_Metadata_Provider::instance() * @return FontAwesome_Metadata_Provider * @internal */ function fa_metadata_provider() { return FontAwesome_Metadata_Provider::instance(); }