| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* @copyright © Melograno Venture Studio. All rights reserved. |
| 5 |
* @licence See LICENCE.md for license details. |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace IvyForms\ValueObjects\Field; |
| 9 |
|
| 10 |
// phpcs:disable PSR1.Files.SideEffects |
| 11 |
if (!defined('ABSPATH')) { |
| 12 |
exit; // Exit if accessed directly |
| 13 |
} |
| 14 |
|
| 15 |
/** |
| 16 |
* Class TimeFieldGeneralSettings |
| 17 |
* |
| 18 |
* Encapsulates time-specific settings extracted from FieldGeneralSettings. |
| 19 |
*/ |
| 20 |
final class TimeFieldGeneralSettings |
| 21 |
{ |
| 22 |
/** |
| 23 |
* @var string |
| 24 |
*/ |
| 25 |
private string $timeFieldType; |
| 26 |
|
| 27 |
/** |
| 28 |
* @var string |
| 29 |
*/ |
| 30 |
private string $timeFormat; |
| 31 |
|
| 32 |
public function __construct(string $timeFieldType = '', string $timeFormat = '') |
| 33 |
{ |
| 34 |
$this->timeFieldType = $timeFieldType; |
| 35 |
$this->timeFormat = $timeFormat; |
| 36 |
} |
| 37 |
|
| 38 |
/** |
| 39 |
* Get timeFieldType. |
| 40 |
*/ |
| 41 |
public function getTimeFieldType(): string |
| 42 |
{ |
| 43 |
return $this->timeFieldType; |
| 44 |
} |
| 45 |
|
| 46 |
/** |
| 47 |
* Set timeFieldType. |
| 48 |
*/ |
| 49 |
public function setTimeFieldType(string $timeFieldType): void |
| 50 |
{ |
| 51 |
$this->timeFieldType = $timeFieldType; |
| 52 |
} |
| 53 |
|
| 54 |
/** |
| 55 |
* Get timeFormat. |
| 56 |
*/ |
| 57 |
public function getTimeFormat(): string |
| 58 |
{ |
| 59 |
return $this->timeFormat; |
| 60 |
} |
| 61 |
|
| 62 |
/** |
| 63 |
* Set timeFormat. |
| 64 |
*/ |
| 65 |
public function setTimeFormat(string $timeFormat): void |
| 66 |
{ |
| 67 |
$this->timeFormat = $timeFormat; |
| 68 |
} |
| 69 |
|
| 70 |
/** |
| 71 |
* @return array<string, string> |
| 72 |
*/ |
| 73 |
public function toArray(): array |
| 74 |
{ |
| 75 |
return [ |
| 76 |
'timeFieldType' => $this->getTimeFieldType(), |
| 77 |
'timeFormat' => $this->getTimeFormat(), |
| 78 |
]; |
| 79 |
} |
| 80 |
} |
| 81 |
|