From c77c7fcd553ed5cccd4d2cde9cd780a5eb1fbe1c Mon Sep 17 00:00:00 2001 From: Netkas Date: Thu, 15 Dec 2022 01:06:23 -0500 Subject: [PATCH] Added \ncc\Classes\PhpExtension > PhpRuntime to import PHP packages https://git.n64.cc/nosial/ncc/-/issues/33 --- src/ncc/Classes/PhpExtension/PhpRuntime.php | 49 +++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src/ncc/Classes/PhpExtension/PhpRuntime.php diff --git a/src/ncc/Classes/PhpExtension/PhpRuntime.php b/src/ncc/Classes/PhpExtension/PhpRuntime.php new file mode 100644 index 0000000..20aeb4f --- /dev/null +++ b/src/ncc/Classes/PhpExtension/PhpRuntime.php @@ -0,0 +1,49 @@ +getInstallPaths()->getBinPath() . DIRECTORY_SEPARATOR . 'autoload.php'; + $static_files = $versionEntry->getInstallPaths()->getBinPath() . DIRECTORY_SEPARATOR . 'static_autoload.bin'; + + if(file_exists($autoload_path) && !in_array(RuntimeImportOptions::ImportAutoloader, $options)) + { + require_once($autoload_path); + } + + if(file_exists($static_files) && !in_array(RuntimeImportOptions::ImportStaticFiles, $options)) + { + $static_files = ZiProto::decode(IO::fread($static_files)); + foreach($static_files as $file) + require_once($file); + } + + if(!file_exists($autoload_path) && !file_exists($static_files)) + return false; + + return true; + } + } \ No newline at end of file