jcb-compiler/src/268b85ef-49f3-4c39-8187-bb1.../code.power

50 lines
1.1 KiB
Plaintext

/**
* Compiler Placeholder
*
* @var Placeholder
* @since 3.2.0
**/
protected Placeholder $placeholder;
/**
* Constant Paths
*
* @var array
* @since 3.2.0
**/
protected array $paths;
/**
* Constructor.
*
* @param Placeholder|null $placeholder The Compiler Placeholder object.
* @param Constantpaths|null $paths The Constant Paths object.
*
* @since 3.2.0
*/
public function __construct(?Placeholder $placeholder = null, ?Constantpaths $paths = null)
{
$this->placeholder = $placeholder ?: Compiler::_('Placeholder');
$paths = $paths ?: Compiler::_('Utilities.Constantpaths');
// load the constant paths
$this->paths = $paths->get();
}
/**
* Update path with dynamic value
*
* @param string $path The path to update
*
* @return string The updated path
* @since 3.2.0
*/
public function update(string $path): string
{
return $this->placeholder->update_(
$this->placeholder->update(
$path, $this->paths
)
);
}