Skip to content

Commit

Permalink
refactor(libextism): change method visibilities
Browse files Browse the repository at this point in the history
  • Loading branch information
yigitcukuren committed Jul 4, 2024
1 parent 8611e0b commit 7fa481f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/LibExtism.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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) {
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down

0 comments on commit 7fa481f

Please sign in to comment.