Skip to content

Commit ce25677

Browse files
authored
feat: add default value (#5)
* feat: add default value * style: formatting
1 parent 1e83427 commit ce25677

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/NotFound/Layout/Inputs/AbstractInput.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@ public function setValue(mixed $value): self
5252
return $this;
5353
}
5454

55+
public function setDefaultValue(mixed $defaultValue): self
56+
{
57+
if (! is_string($defaultValue)) {
58+
$this->abortLogSetValueError('AbstractInput', 'string', $defaultValue);
59+
}
60+
$this->properties->defaultValue = $defaultValue;
61+
62+
return $this;
63+
}
64+
5565
protected function abortLogSetValueError(string $class, string $requiredType, mixed $newValue): void
5666
{
5767
$message = sprintf(

src/NotFound/Layout/Inputs/LayoutInputSlider.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,14 @@ public function setMax(int $max): self
2121

2222
return $this;
2323
}
24+
25+
public function setDefaultValue(mixed $defaultValue): self
26+
{
27+
if (! is_int($defaultValue)) {
28+
$this->abortLogSetValueError('InputSlider', 'integer', $defaultValue);
29+
}
30+
$this->properties->defaultValue = $defaultValue;
31+
32+
return $this;
33+
}
2434
}

0 commit comments

Comments
 (0)