Skip to content

Commit

Permalink
feat: #356 support added to add own dynamic variables
Browse files Browse the repository at this point in the history
  • Loading branch information
mitulgolakiya committed Aug 4, 2022
1 parent 58fdcbe commit 30351a3
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/Common/GeneratorConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class GeneratorConfig
/** @var GeneratorField[] */
public array $fields = [];

private static $dynamicVarrs = [];

/** @var GeneratorFieldRelation[] */
public array $relations = [];

Expand All @@ -45,6 +47,23 @@ public function init()
$this->prepareOptions();
}

public static function addDynamicVar(string $name, $value)
{
self::$dynamicVarrs[$name] = $value;
}

public static function addDynamicVars(array $vars)
{
foreach ($vars as $key => $value) {
self::$dynamicVarrs[$key] = $value;
}
}

public function getDynamicVar(string $name)
{
return self::$dynamicVarrs[$name];
}

public function setCommand(Command &$command)
{
$this->command = &$command;
Expand Down

0 comments on commit 30351a3

Please sign in to comment.