Size validator for comment dimensions and margins
This commit is contained in:
parent
0502fd3e7f
commit
a16badbcc4
|
|
@ -14,7 +14,7 @@ class Size
|
||||||
|
|
||||||
public function __construct(string $size)
|
public function __construct(string $size)
|
||||||
{
|
{
|
||||||
$this->valid = preg_match(self::REGEXP_SIZE_VALIDATION, $size, $matches);
|
$this->valid = preg_match(self::REGEXP_SIZE_VALIDATION, $size, $matches);
|
||||||
if ($this->valid) {
|
if ($this->valid) {
|
||||||
$this->size = $matches['size'];
|
$this->size = $matches['size'];
|
||||||
$this->unit = $matches['unit'] ?? 'pt';
|
$this->unit = $matches['unit'] ?? 'pt';
|
||||||
|
|
@ -26,12 +26,12 @@ class Size
|
||||||
return $this->valid;
|
return $this->valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function size()
|
public function size(): string
|
||||||
{
|
{
|
||||||
return $this->size;
|
return $this->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function unit()
|
public function unit(): string
|
||||||
{
|
{
|
||||||
return $this->unit;
|
return $this->unit;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue