From 3d809456d7f6bcb4a7ffff5bf7cf22d640fc125f Mon Sep 17 00:00:00 2001 From: Victor Westerlund Date: Thu, 30 Oct 2025 18:43:42 +0100 Subject: [PATCH] refactor: include Vegvisir source files from Reflect with a function --- src/Scaffold.php | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/src/Scaffold.php b/src/Scaffold.php index 313bb7d..9258e39 100644 --- a/src/Scaffold.php +++ b/src/Scaffold.php @@ -5,25 +5,17 @@ use VV; use Reflect\Path; - class Scaffold { - /** - * Include a source file - * - * @param string $pathname Relative path from project root to a source file - */ - public static function include(string $pathname): void { - if (!class_exists("VV")) { - self::load_vegvisir_kernel(); - } - - require_once VV::root($pathname); - } - - /** - * Load the Vegvisir VV class from Reflect - */ - private static function load_vegvisir_kernel(): void { + /** + * Include a source file from either Vegvisir or Reflect + * + * @param string $pathname Relative path from project root to a source file + */ + function load(string $pathname): void { + // Load the Vegvisir VV clas from Reflect + if (!class_exists("VV")) { require_once Path::root("vegvisir/src/kernel/Init.php"); require_once Path::root("vegvisir/src/request/VV.php"); } - } \ No newline at end of file + + require_once VV::root($pathname); + }