protected function add_access_token_endpoint( $git, $endpoint ) {
		// This will return if checking during shiny updates.
		if ( null === static::$options ) {
			return $endpoint;
		}
		$key              = null;
		$token            = null;
		$token_enterprise = null;

		switch ( $git->type->git ) {
			case 'github':
				$key              = 'access_token';
				$token            = 'github_access_token';
				$token_enterprise = 'github_enterprise_token';
				break;
			case 'gitlab':
				$key              = 'private_token';
				$token            = 'gitlab_access_token';
				$token_enterprise = 'gitlab_enterprise_token';
				break;
			case 'gitea':
				$key              = 'access_token';
				$token            = 'gitea_access_token';
				$token_enterprise = 'gitea_access_token';
				break;
			case 'bitbucket':
				return $endpoint;
		}

		// Add hosted access token.
		if ( ! empty( static::$options[ $token ] ) ) {
			$endpoint = add_query_arg( $key, static::$options[ $token ], $endpoint );
		}

		// Add Enterprise access token.
		if ( ! empty( $git->type->enterprise ) &&
			! empty( static::$options[ $token_enterprise ] )
		) {
			$endpoint = remove_query_arg( $key, $endpoint );
			$endpoint = add_query_arg( $key, static::$options[ $token_enterprise ], $endpoint );
		}

		// Add repo access token.
		if ( ! empty( static::$options[ $git->type->slug ] ) ) {
			$endpoint = remove_query_arg( $key, $endpoint );
			$endpoint = add_query_arg( $key, static::$options[ $git->type->slug ], $endpoint );
		}

		return $endpoint;
	}
protected function add_access_token_endpoint( $git, $endpoint ) {
		// This will return if checking during shiny updates.
		if ( null === static::$options ) {
			return $endpoint;
		}
		$key              = null;
		$token            = null;
		$token_enterprise = null;

		switch ( $git->type->git ) {
			case 'github':
				$key              = 'access_token';
				$token            = 'github_access_token';
				$token_enterprise = 'github_enterprise_token';
				break;
			case 'gitlab':
				$key              = 'private_token';
				$token            = 'gitlab_access_token';
				$token_enterprise = 'gitlab_enterprise_token';
				break;
			case 'gitea':
				$key              = 'access_token';
				$token            = 'gitea_access_token';
				$token_enterprise = 'gitea_access_token';
				break;
			case 'bitbucket':
				return $endpoint;
		}

		// Add hosted access token.
		if ( ! empty( static::$options[ $token ] ) ) {
			$endpoint = add_query_arg( $key, static::$options[ $token ], $endpoint );
		}

		// Add Enterprise access token.
		if ( ! empty( $git->type->enterprise ) &&
			! empty( static::$options[ $token_enterprise ] )
		) {
			$endpoint = remove_query_arg( $key, $endpoint );
			$endpoint = add_query_arg( $key, static::$options[ $token_enterprise ], $endpoint );
		}

		// Add repo access token.
		if ( ! empty( static::$options[ $git->type->slug ] ) ) {
			$endpoint = remove_query_arg( $key, $endpoint );
			$endpoint = add_query_arg( $key, static::$options[ $git->type->slug ], $endpoint );
		}

		return $endpoint;
	}
protected function add_access_token_endpoint ( $ git , $ endpoint ) { // This will return if checking during shiny updates. if ( null === static :: $ options ) { return $ endpoint ; } $ key = null ; $ token = null ; $ token_enterprise = null ; switch ( $ git -> type -> git ) { case 'github' : $ key = 'access_token' ; $ token = 'github_access_token' ; $ token_enterprise = 'github_enterprise_token' ; break ; case 'gitlab' : $ key = 'private_token' ; $ token = 'gitlab_access_token' ; $ token_enterprise = 'gitlab_enterprise_token' ; break ; case 'gitea' : $ key = 'access_token' ; $ token = 'gitea_access_token' ; $ token_enterprise = 'gitea_access_token' ; break ; case 'bitbucket' : return $ endpoint ; } // Add hosted access token. if ( ! empty ( static :: $ options [ $ token ] ) ) { $ endpoint = add_query_arg ( $ key , static :: $ options [ $ token ] , $ endpoint ) ; } // Add Enterprise access token. if ( ! empty ( $ git -> type -> enterprise ) && ! empty ( static :: $ options [ $ token_enterprise ] ) ) { $ endpoint = remove_query_arg ( $ key , $ endpoint ) ; $ endpoint = add_query_arg ( $ key , static :: $ options [ $ token_enterprise ] , $ endpoint ) ; } // Add repo access token. if ( ! empty ( static :: $ options [ $ git -> type -> slug ] ) ) { $ endpoint = remove_query_arg ( $ key , $ endpoint ) ; $ endpoint = add_query_arg ( $ key , static :: $ options [ $ git -> type -> slug ] , $ endpoint ) ; } return $ endpoint ; }
Add appropriate access token to endpoint.

@access protected

@param GitHub_API|GitLab_API $git      Class containing the GitAPI used.
@param string                $endpoint The endpoint being accessed.

@return string $endpoint
Add appropriate access token to endpoint .