mirror of
https://codeberg.org/vlw/scaffold.git
synced 2025-11-05 06:02:42 +01:00
feat: add dedicated class for crosstalk between Vegvisir and Reflect (#2)
In this PR we move the Vegvisir `VV` class import into Reflect from the API class into its own `Scaffold` class. This new class will include everything that is required for crosstalk between Vegvisir and Reflect. Reviewed-on: https://codeberg.org/vlw/scaffold/pulls/2
This commit is contained in:
parent
3357416ad0
commit
dbdde9fcaf
2 changed files with 29 additions and 4 deletions
|
|
@ -7,12 +7,8 @@
|
||||||
|
|
||||||
namespace vlw\Scaffold\API;
|
namespace vlw\Scaffold\API;
|
||||||
|
|
||||||
use Reflect\Path;
|
|
||||||
use Reflect\Rules\Ruleset;
|
use Reflect\Rules\Ruleset;
|
||||||
|
|
||||||
require_once Path::root("vegvisir/src/kernel/Init.php");
|
|
||||||
require_once Path::root("vegvisir/src/request/VV.php");
|
|
||||||
|
|
||||||
class API {
|
class API {
|
||||||
/**
|
/**
|
||||||
* Create a new API request with automatic request validation
|
* Create a new API request with automatic request validation
|
||||||
|
|
|
||||||
29
src/Scaffold.php
Normal file
29
src/Scaffold.php
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace vlw\Scaffold;
|
||||||
|
|
||||||
|
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 {
|
||||||
|
require_once Path::root("vegvisir/src/kernel/Init.php");
|
||||||
|
require_once Path::root("vegvisir/src/request/VV.php");
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue