charitable
/
vendor
/
square
/
square
/
src
/
Legacy
/
Models
/
Builders
/
CustomAttributeBuilder.php
CustomAttributeBuilder.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.8.13, at vendor/square/square/src/Legacy/Models/Builders/CustomAttributeBuilder.php
| 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\CustomAttribute; |
| 9 | use Square\Legacy\Models\CustomAttributeDefinition; |
| 10 | |
| 11 | /** |
| 12 | * Builder for model CustomAttribute |
| 13 | * |
| 14 | * @see CustomAttribute |
| 15 | */ |
| 16 | class CustomAttributeBuilder |
| 17 | { |
| 18 | /** |
| 19 | * @var CustomAttribute |
| 20 | */ |
| 21 | private $instance; |
| 22 | |
| 23 | private function __construct(CustomAttribute $instance) |
| 24 | { |
| 25 | $this->instance = $instance; |
| 26 | } |
| 27 | |
| 28 | /** |
| 29 | * Initializes a new Custom Attribute Builder object. |
| 30 | */ |
| 31 | public static function init(): self |
| 32 | { |
| 33 | return new self(new CustomAttribute()); |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * Sets key field. |
| 38 | * |
| 39 | * @param string|null $value |
| 40 | */ |
| 41 | public function key(?string $value): self |
| 42 | { |
| 43 | $this->instance->setKey($value); |
| 44 | return $this; |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Unsets key field. |
| 49 | */ |
| 50 | public function unsetKey(): self |
| 51 | { |
| 52 | $this->instance->unsetKey(); |
| 53 | return $this; |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * Sets value field. |
| 58 | * |
| 59 | * @param mixed $value |
| 60 | */ |
| 61 | public function value($value): self |
| 62 | { |
| 63 | $this->instance->setValue($value); |
| 64 | return $this; |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * Unsets value field. |
| 69 | */ |
| 70 | public function unsetValue(): self |
| 71 | { |
| 72 | $this->instance->unsetValue(); |
| 73 | return $this; |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * Sets version field. |
| 78 | * |
| 79 | * @param int|null $value |
| 80 | */ |
| 81 | public function version(?int $value): self |
| 82 | { |
| 83 | $this->instance->setVersion($value); |
| 84 | return $this; |
| 85 | } |
| 86 | |
| 87 | /** |
| 88 | * Sets visibility field. |
| 89 | * |
| 90 | * @param string|null $value |
| 91 | */ |
| 92 | public function visibility(?string $value): self |
| 93 | { |
| 94 | $this->instance->setVisibility($value); |
| 95 | return $this; |
| 96 | } |
| 97 | |
| 98 | /** |
| 99 | * Sets definition field. |
| 100 | * |
| 101 | * @param CustomAttributeDefinition|null $value |
| 102 | */ |
| 103 | public function definition(?CustomAttributeDefinition $value): self |
| 104 | { |
| 105 | $this->instance->setDefinition($value); |
| 106 | return $this; |
| 107 | } |
| 108 | |
| 109 | /** |
| 110 | * Sets updated at field. |
| 111 | * |
| 112 | * @param string|null $value |
| 113 | */ |
| 114 | public function updatedAt(?string $value): self |
| 115 | { |
| 116 | $this->instance->setUpdatedAt($value); |
| 117 | return $this; |
| 118 | } |
| 119 | |
| 120 | /** |
| 121 | * Sets created at field. |
| 122 | * |
| 123 | * @param string|null $value |
| 124 | */ |
| 125 | public function createdAt(?string $value): self |
| 126 | { |
| 127 | $this->instance->setCreatedAt($value); |
| 128 | return $this; |
| 129 | } |
| 130 | |
| 131 | /** |
| 132 | * Initializes a new Custom Attribute object. |
| 133 | */ |
| 134 | public function build(): CustomAttribute |
| 135 | { |
| 136 | return CoreHelper::clone($this->instance); |
| 137 | } |
| 138 | } |
| 139 |