aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/downloader
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/downloader
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/downloader')
-rw-r--r--crates/shirabe/src/downloader/download_manager.rs7
-rw-r--r--crates/shirabe/src/downloader/file_downloader.rs6
-rw-r--r--crates/shirabe/src/downloader/git_downloader.rs16
-rw-r--r--crates/shirabe/src/downloader/path_downloader.rs4
-rw-r--r--crates/shirabe/src/downloader/perforce_downloader.rs2
-rw-r--r--crates/shirabe/src/downloader/svn_downloader.rs6
-rw-r--r--crates/shirabe/src/downloader/transport_exception.rs8
7 files changed, 23 insertions, 26 deletions
diff --git a/crates/shirabe/src/downloader/download_manager.rs b/crates/shirabe/src/downloader/download_manager.rs
index c8fb86a7..15b009e6 100644
--- a/crates/shirabe/src/downloader/download_manager.rs
+++ b/crates/shirabe/src/downloader/download_manager.rs
@@ -20,7 +20,7 @@ use shirabe_php_shim::{
#[derive(Debug)]
pub struct DownloadManager {
/// @var IOInterface
- pub(crate) io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
+ io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
/// @var bool
prefer_dist: bool,
/// @var bool
@@ -425,10 +425,7 @@ impl DownloadManager {
/// Determines the install preference of a package
///
/// @param PackageInterface $package package instance
- pub(crate) fn resolve_package_install_preference(
- &self,
- package: PackageInterfaceHandle,
- ) -> String {
+ fn resolve_package_install_preference(&self, package: PackageInterfaceHandle) -> String {
for (pattern, preference) in &self.package_preferences {
let pattern_regex = format!(
"{{^{}$}}i",
diff --git a/crates/shirabe/src/downloader/file_downloader.rs b/crates/shirabe/src/downloader/file_downloader.rs
index ab9c3672..64b348e1 100644
--- a/crates/shirabe/src/downloader/file_downloader.rs
+++ b/crates/shirabe/src/downloader/file_downloader.rs
@@ -59,13 +59,13 @@ pub struct FileDownloader {
/// @var Config
pub(crate) config: std::rc::Rc<std::cell::RefCell<Config>>,
/// @var HttpDownloader
- pub(crate) http_downloader: std::rc::Rc<std::cell::RefCell<HttpDownloader>>,
+ http_downloader: std::rc::Rc<std::cell::RefCell<HttpDownloader>>,
/// @var Filesystem
pub(crate) filesystem: std::rc::Rc<std::cell::RefCell<Filesystem>>,
/// @var ?Cache
- pub(crate) cache: Option<std::rc::Rc<std::cell::RefCell<Cache>>>,
+ cache: Option<std::rc::Rc<std::cell::RefCell<Cache>>>,
/// @var ?EventDispatcher
- pub(crate) event_dispatcher: Option<std::rc::Rc<std::cell::RefCell<EventDispatcher>>>,
+ event_dispatcher: Option<std::rc::Rc<std::cell::RefCell<EventDispatcher>>>,
/// @var ProcessExecutor
pub(crate) process: std::rc::Rc<std::cell::RefCell<ProcessExecutor>>,
/// @var array<string, string> Map of package name to cache key
diff --git a/crates/shirabe/src/downloader/git_downloader.rs b/crates/shirabe/src/downloader/git_downloader.rs
index 9e468a44..4394cc95 100644
--- a/crates/shirabe/src/downloader/git_downloader.rs
+++ b/crates/shirabe/src/downloader/git_downloader.rs
@@ -249,7 +249,7 @@ impl GitDownloader {
///
/// @throws \RuntimeException
/// @return null|string if a string is returned, it is the commit reference that was checked out if the original could not be found
- pub(crate) fn update_to_commit(
+ fn update_to_commit(
&self,
package: PackageInterfaceHandle,
path: &str,
@@ -486,7 +486,7 @@ impl GitDownloader {
.into())
}
- pub(crate) fn update_origin_url(&self, path: &str, url: &str) {
+ fn update_origin_url(&self, path: &str, url: &str) {
let mut output = String::new();
self.inner.process.borrow_mut().execute_args(
&[
@@ -503,7 +503,7 @@ impl GitDownloader {
self.set_push_url(path, url);
}
- pub(crate) fn set_push_url(&self, path: &str, url: &str) {
+ fn set_push_url(&self, path: &str, url: &str) {
// set push url for github projects
let mut match_: IndexMap<CaptureKey, String> = IndexMap::new();
if Preg::is_match3(
@@ -549,7 +549,7 @@ impl GitDownloader {
}
/// @throws \RuntimeException
- pub(crate) async fn discard_changes(&self, path: &str) -> anyhow::Result<Option<PhpMixed>> {
+ async fn discard_changes(&self, path: &str) -> anyhow::Result<Option<PhpMixed>> {
let path = self.normalize_path(path);
let mut output = String::new();
if self.inner.process.borrow_mut().execute_args(
@@ -580,7 +580,7 @@ impl GitDownloader {
}
/// @throws \RuntimeException
- pub(crate) async fn stash_changes(&self, path: &str) -> anyhow::Result<Option<PhpMixed>> {
+ async fn stash_changes(&self, path: &str) -> anyhow::Result<Option<PhpMixed>> {
let path = self.normalize_path(path);
let mut output = String::new();
if self.inner.process.borrow_mut().execute_args(
@@ -604,7 +604,7 @@ impl GitDownloader {
}
/// @throws \RuntimeException
- pub(crate) fn view_diff(&self, path: &str) -> anyhow::Result<()> {
+ fn view_diff(&self, path: &str) -> anyhow::Result<()> {
let path = self.normalize_path(path);
let mut output = String::new();
if self.inner.process.borrow_mut().execute_args(
@@ -625,7 +625,7 @@ impl GitDownloader {
Ok(())
}
- pub(crate) fn normalize_path(&self, path: &str) -> String {
+ fn normalize_path(&self, path: &str) -> String {
let mut path = path.to_string();
if Platform::is_windows() && strlen(&path) > 0 {
let mut base_path = path.clone();
@@ -655,7 +655,7 @@ impl GitDownloader {
path
}
- pub(crate) fn get_short_hash(&self, reference: &str) -> String {
+ fn get_short_hash(&self, reference: &str) -> String {
if !self.inner.io.is_verbose() && Preg::is_match(php_regex!(r"{^[0-9a-f]{40}$}"), reference)
{
return substr(reference, 0, Some(10));
diff --git a/crates/shirabe/src/downloader/path_downloader.rs b/crates/shirabe/src/downloader/path_downloader.rs
index 44940fef..6b3531f4 100644
--- a/crates/shirabe/src/downloader/path_downloader.rs
+++ b/crates/shirabe/src/downloader/path_downloader.rs
@@ -28,7 +28,7 @@ use shirabe_symfony_filesystem::Filesystem as SymfonyFilesystem;
#[derive(Debug)]
pub struct PathDownloader {
- pub(crate) inner: FileDownloader,
+ inner: FileDownloader,
}
impl_php_class!(PathDownloader, r"Composer\Downloader\PathDownloader");
@@ -79,7 +79,7 @@ impl PathDownloader {
None
}
- pub(crate) fn get_install_operation_appendix(
+ fn get_install_operation_appendix(
&self,
package: PackageInterfaceHandle,
path: &str,
diff --git a/crates/shirabe/src/downloader/perforce_downloader.rs b/crates/shirabe/src/downloader/perforce_downloader.rs
index 9d4ff2a3..f61660be 100644
--- a/crates/shirabe/src/downloader/perforce_downloader.rs
+++ b/crates/shirabe/src/downloader/perforce_downloader.rs
@@ -20,7 +20,7 @@ use shirabe_php_shim::{PhpMixed, impl_php_class};
#[derive(Debug)]
pub struct PerforceDownloader {
inner: VcsDownloaderBase,
- pub(crate) perforce: std::cell::RefCell<Option<Box<dyn PerforceInterface>>>,
+ perforce: std::cell::RefCell<Option<Box<dyn PerforceInterface>>>,
}
impl_php_class!(
diff --git a/crates/shirabe/src/downloader/svn_downloader.rs b/crates/shirabe/src/downloader/svn_downloader.rs
index 59916aa2..1487a710 100644
--- a/crates/shirabe/src/downloader/svn_downloader.rs
+++ b/crates/shirabe/src/downloader/svn_downloader.rs
@@ -23,7 +23,7 @@ use shirabe_php_shim::{
#[derive(Debug)]
pub struct SvnDownloader {
inner: VcsDownloaderBase,
- pub(crate) cache_credentials: std::cell::Cell<bool>,
+ cache_credentials: std::cell::Cell<bool>,
}
impl_php_class!(SvnDownloader, r"Composer\Downloader\SvnDownloader");
@@ -41,7 +41,7 @@ impl SvnDownloader {
}
}
- pub(crate) fn execute(
+ fn execute(
&self,
package: PackageInterfaceHandle,
base_url: &str,
@@ -67,7 +67,7 @@ impl SvnDownloader {
})
}
- pub(crate) async fn discard_changes(&self, path: &str) -> anyhow::Result<Option<PhpMixed>> {
+ async fn discard_changes(&self, path: &str) -> anyhow::Result<Option<PhpMixed>> {
let mut output = String::new();
if self.inner.process.borrow_mut().execute_args(
["svn", "revert", "-R", "."].map(|s| s.to_string()).as_ref(),
diff --git a/crates/shirabe/src/downloader/transport_exception.rs b/crates/shirabe/src/downloader/transport_exception.rs
index da8b4c50..c9e1a092 100644
--- a/crates/shirabe/src/downloader/transport_exception.rs
+++ b/crates/shirabe/src/downloader/transport_exception.rs
@@ -5,10 +5,10 @@ use shirabe_php_shim::{PhpMixed, RuntimeException};
#[derive(Debug, Clone)]
pub struct TransportException {
inner: RuntimeException,
- pub(crate) headers: Option<Vec<String>>,
- pub(crate) response: Option<String>,
- pub(crate) status_code: Option<i64>,
- pub(crate) response_info: Vec<PhpMixed>,
+ headers: Option<Vec<String>>,
+ response: Option<String>,
+ status_code: Option<i64>,
+ response_info: Vec<PhpMixed>,
}
impl TransportException {