
| Current Path : /var/www/html/vendor/consolidation/annotated-command/src/Parser/Internal/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/vendor/consolidation/annotated-command/src/Parser/Internal/DefaultValueFromString.php |
<?php
namespace Consolidation\AnnotatedCommand\Parser\Internal;
/**
* Hold a default value.
*/
class DefaultValueFromString
{
protected $value;
protected function __construct($value)
{
$this->value = $value;
}
public static function fromString($defaultValue)
{
$defaults = [
'null' => null,
'true' => true,
'false' => false,
"''" => '',
'[]' => [],
];
if (array_key_exists($defaultValue, $defaults)) {
$defaultValue = $defaults[$defaultValue];
}
return new self($defaultValue);
}
public function value()
{
return $this->value;
}
}