aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/repository/vcs/gitlab_driver.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-08-16 00:59:54 +0900
committernsfisis <nsfisis@gmail.com>2026-08-16 01:03:45 +0900
commit3a388b98a9aa6a14b1c7f7dc909c109cf9837800 (patch)
tree593e342313c6e6bd3ec2943a1690b8798e0a83ae /crates/shirabe/src/repository/vcs/gitlab_driver.rs
parentaad468e8b75ffc3e87ea6dfa22c53a8299fc08da (diff)
downloadphp-shirabe-3a388b98a9aa6a14b1c7f7dc909c109cf9837800.tar.gz
php-shirabe-3a388b98a9aa6a14b1c7f7dc909c109cf9837800.tar.zst
php-shirabe-3a388b98a9aa6a14b1c7f7dc909c109cf9837800.zip
refactor: narrow pub(crate) items to private
Porting mapped every PHP `protected` member onto `pub(crate)`, which is wider than nearly all of them need. Each item demoted here is reached only from the module that defines it, so the crate-wide visibility conveyed nothing. Every `pub(crate)` that survives has at least one reader in another module of the same crate. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/repository/vcs/gitlab_driver.rs')
-rw-r--r--crates/shirabe/src/repository/vcs/gitlab_driver.rs25
1 files changed, 11 insertions, 14 deletions
diff --git a/crates/shirabe/src/repository/vcs/gitlab_driver.rs b/crates/shirabe/src/repository/vcs/gitlab_driver.rs
index 669f1376..df1ad686 100644
--- a/crates/shirabe/src/repository/vcs/gitlab_driver.rs
+++ b/crates/shirabe/src/repository/vcs/gitlab_driver.rs
@@ -26,7 +26,7 @@ use shirabe_php_shim::{
/// Driver for GitLab API, use the Git driver for local checkouts.
#[derive(Debug)]
pub struct GitLabDriver {
- pub(crate) inner: VcsDriverBase,
+ inner: VcsDriverBase,
/// @phpstan-var 'https'|'http'
scheme: String,
namespace: String,
@@ -40,10 +40,10 @@ pub struct GitLabDriver {
/// @var array<int|string, string> Map of branch name to identifier
branches: Option<IndexMap<String, String>>,
/// Git Driver
- pub(crate) git_driver: Option<GitDriver>,
+ git_driver: Option<GitDriver>,
/// Protocol to force use of for repository URLs.
/// @var string One of ssh, http
- pub(crate) protocol: String,
+ protocol: String,
/// Defaults to true unless we can make sure it is public
/// @var bool defines whether the repo is private or not
is_private: bool,
@@ -595,10 +595,7 @@ impl GitLabDriver {
}
/// @return string[] where keys are named references like tags or branches and the value a sha
- pub(crate) fn get_references(
- &mut self,
- r#type: &str,
- ) -> anyhow::Result<IndexMap<String, String>> {
+ fn get_references(&mut self, r#type: &str) -> anyhow::Result<IndexMap<String, String>> {
let per_page = 100;
let mut resource: Option<String> = Some(format!(
"{}/repository/{}?per_page={}",
@@ -661,7 +658,7 @@ impl GitLabDriver {
Ok(references)
}
- pub(crate) fn fetch_project(&mut self) -> anyhow::Result<()> {
+ fn fetch_project(&mut self) -> anyhow::Result<()> {
if self.project.is_some() {
return Ok(());
}
@@ -694,7 +691,7 @@ impl GitLabDriver {
/// @phpstan-impure
///
/// @throws \RuntimeException
- pub(crate) fn attempt_clone_fallback(&mut self) -> anyhow::Result<bool> {
+ fn attempt_clone_fallback(&mut self) -> anyhow::Result<bool> {
let url = if !self.is_private {
self.generate_public_url()
} else {
@@ -723,7 +720,7 @@ impl GitLabDriver {
}
/// Generate an SSH URL
- pub(crate) fn generate_ssh_url(&self) -> String {
+ fn generate_ssh_url(&self) -> String {
if self.has_nonstandard_origin {
return format!(
"ssh://git@{}/{}/{}.git",
@@ -737,14 +734,14 @@ impl GitLabDriver {
)
}
- pub(crate) fn generate_public_url(&self) -> String {
+ fn generate_public_url(&self) -> String {
format!(
"{}://{}/{}/{}.git",
self.scheme, self.inner.origin_url, self.namespace, self.repository
)
}
- pub(crate) fn setup_git_driver(&mut self, url: &str) -> anyhow::Result<()> {
+ fn setup_git_driver(&mut self, url: &str) -> anyhow::Result<()> {
let mut repo_config: IndexMap<String, PhpMixed> = IndexMap::new();
repo_config.insert("url".to_string(), PhpMixed::String(url.to_string()));
let mut git_driver = GitDriver::new(
@@ -759,7 +756,7 @@ impl GitLabDriver {
Ok(())
}
- pub(crate) fn get_contents(
+ fn get_contents(
&mut self,
url: &str,
fetching_repo_data: bool,
@@ -1009,7 +1006,7 @@ impl GitLabDriver {
Ok(self.project.clone())
}
- pub(crate) fn get_next_page(&self, response: &Response) -> Option<String> {
+ fn get_next_page(&self, response: &Response) -> Option<String> {
let header = response.get_header("link").unwrap_or_default();
let links = explode(",", &header);