| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace Square\Legacy\Models\Builders; |
| 6 |
|
| 7 |
use Core\Utils\CoreHelper; |
| 8 |
use Square\Legacy\Models\Range; |
| 9 |
|
| 10 |
/** |
| 11 |
* Builder for model Range |
| 12 |
* |
| 13 |
* @see Range |
| 14 |
*/ |
| 15 |
class RangeBuilder |
| 16 |
{ |
| 17 |
/** |
| 18 |
* @var Range |
| 19 |
*/ |
| 20 |
private $instance; |
| 21 |
|
| 22 |
private function __construct(Range $instance) |
| 23 |
{ |
| 24 |
$this->instance = $instance; |
| 25 |
} |
| 26 |
|
| 27 |
/** |
| 28 |
* Initializes a new Range Builder object. |
| 29 |
*/ |
| 30 |
public static function init(): self |
| 31 |
{ |
| 32 |
return new self(new Range()); |
| 33 |
} |
| 34 |
|
| 35 |
/** |
| 36 |
* Sets min field. |
| 37 |
* |
| 38 |
* @param string|null $value |
| 39 |
*/ |
| 40 |
public function min(?string $value): self |
| 41 |
{ |
| 42 |
$this->instance->setMin($value); |
| 43 |
return $this; |
| 44 |
} |
| 45 |
|
| 46 |
/** |
| 47 |
* Unsets min field. |
| 48 |
*/ |
| 49 |
public function unsetMin(): self |
| 50 |
{ |
| 51 |
$this->instance->unsetMin(); |
| 52 |
return $this; |
| 53 |
} |
| 54 |
|
| 55 |
/** |
| 56 |
* Sets max field. |
| 57 |
* |
| 58 |
* @param string|null $value |
| 59 |
*/ |
| 60 |
public function max(?string $value): self |
| 61 |
{ |
| 62 |
$this->instance->setMax($value); |
| 63 |
return $this; |
| 64 |
} |
| 65 |
|
| 66 |
/** |
| 67 |
* Unsets max field. |
| 68 |
*/ |
| 69 |
public function unsetMax(): self |
| 70 |
{ |
| 71 |
$this->instance->unsetMax(); |
| 72 |
return $this; |
| 73 |
} |
| 74 |
|
| 75 |
/** |
| 76 |
* Initializes a new Range object. |
| 77 |
*/ |
| 78 |
public function build(): Range |
| 79 |
{ |
| 80 |
return CoreHelper::clone($this->instance); |
| 81 |
} |
| 82 |
} |
| 83 |
|