Skip to content

Commit 30351a3

Browse files
committed
feat: #356 support added to add own dynamic variables
1 parent 58fdcbe commit 30351a3

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/Common/GeneratorConfig.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ class GeneratorConfig
2222
/** @var GeneratorField[] */
2323
public array $fields = [];
2424

25+
private static $dynamicVarrs = [];
26+
2527
/** @var GeneratorFieldRelation[] */
2628
public array $relations = [];
2729

@@ -45,6 +47,23 @@ public function init()
4547
$this->prepareOptions();
4648
}
4749

50+
public static function addDynamicVar(string $name, $value)
51+
{
52+
self::$dynamicVarrs[$name] = $value;
53+
}
54+
55+
public static function addDynamicVars(array $vars)
56+
{
57+
foreach ($vars as $key => $value) {
58+
self::$dynamicVarrs[$key] = $value;
59+
}
60+
}
61+
62+
public function getDynamicVar(string $name)
63+
{
64+
return self::$dynamicVarrs[$name];
65+
}
66+
4867
public function setCommand(Command &$command)
4968
{
5069
$this->command = &$command;

0 commit comments

Comments
 (0)