set_scopes( $scopes ); } /** * Sets the missing scopes that raised this exception. * * @since 1.9.0 * * @param array $scopes OAuth scopes that are required but not yet granted. */ public function set_scopes( array $scopes ) { $this->scopes = $scopes; } /** * Gets the missing scopes that raised this exception. * * @since 1.9.0 * * @return array */ public function get_scopes() { return $this->scopes; } /** * Gets the WP_Error representation of this exception. * * @since 1.9.0 * * @return WP_Error */ public function to_wp_error() { return new WP_Error( static::WP_ERROR_CODE, $this->getMessage(), array( 'status' => 403, // Forbidden. 'scopes' => $this->scopes, ) ); } }