From 7fa481fd037cd5c7b975c86a64f362dd6af03e49 Mon Sep 17 00:00:00 2001 From: Yigit Cukuren Date: Thu, 4 Jul 2024 23:37:54 +0300 Subject: [PATCH] refactor(libextism): change method visibilities --- src/LibExtism.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/LibExtism.php b/src/LibExtism.php index c465649..22b3bae 100644 --- a/src/LibExtism.php +++ b/src/LibExtism.php @@ -11,11 +11,11 @@ public function __construct() $this->ffi = LibExtism::findSo($name); } - public function findSo(string $name): \FFI + private function findSo(string $name): \FFI { $platform = php_uname("s"); $directories = []; - if (LibExtism::startsWith($platform, "windows")) { + if ($this->startsWith($platform, "windows")) { $path = getenv('PATH'); $directories = explode(PATH_SEPARATOR, $path); } else { @@ -39,7 +39,7 @@ public function findSo(string $name): \FFI throw new \RuntimeException('Failed to find shared object. Searched locations: ' . implode(', ', $searchedPaths)); } - public function soname() + private function soname() { $platform = php_uname("s"); switch ($platform) { @@ -109,7 +109,7 @@ public function extism_error(FFI\CData $plugin): ?string return $this->ffi->extism_error($plugin); } - public function extism_plugin_error(FFI\CData $plugin): ?string + private function extism_plugin_error(FFI\CData $plugin): ?string { return $this->ffi->extism_plugin_error($plugin); } @@ -171,7 +171,7 @@ public function toCArray(array $array, string $type): ?FFI\CData return $cArray; } - public function owned(string $type, string $string): ?FFI\CData + private function owned(string $type, string $string): ?FFI\CData { if (strlen($string) == 0) { return null; @@ -182,12 +182,12 @@ public function owned(string $type, string $string): ?FFI\CData return $str; } - public function ownedZero(string $string): ?FFI\CData + private function ownedZero(string $string): ?FFI\CData { return $this->owned("char", "$string\0"); } - public function startsWith($haystack, $needle) + private function startsWith($haystack, $needle) { return strcasecmp(substr($haystack, 0, strlen($needle)), $needle) === 0; }