commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
ReservationBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
16 use stdClass;
17 
21 final class ReservationBuilder implements Builder
22 {
27  private $quantity;
28 
33  private $owner;
34 
39  private $createdAt;
40 
45  private $checkoutStartedAt;
46 
51  public function getQuantity()
52  {
53  return $this->quantity;
54  }
55 
60  public function getOwner()
61  {
62  return $this->owner instanceof ReferenceBuilder ? $this->owner->build() : $this->owner;
63  }
64 
69  public function getCreatedAt()
70  {
71  return $this->createdAt;
72  }
73 
78  public function getCheckoutStartedAt()
79  {
80  return $this->checkoutStartedAt;
81  }
82 
87  public function withQuantity(?int $quantity)
88  {
89  $this->quantity = $quantity;
90 
91  return $this;
92  }
93 
98  public function withOwner(?Reference $owner)
99  {
100  $this->owner = $owner;
101 
102  return $this;
103  }
104 
109  public function withCreatedAt(?string $createdAt)
110  {
111  $this->createdAt = $createdAt;
112 
113  return $this;
114  }
115 
120  public function withCheckoutStartedAt(?string $checkoutStartedAt)
121  {
122  $this->checkoutStartedAt = $checkoutStartedAt;
123 
124  return $this;
125  }
126 
131  public function withOwnerBuilder(?ReferenceBuilder $owner)
132  {
133  $this->owner = $owner;
134 
135  return $this;
136  }
137 
138  public function build(): Reservation
139  {
140  return new ReservationModel(
141  $this->quantity,
142  $this->owner instanceof ReferenceBuilder ? $this->owner->build() : $this->owner,
143  $this->createdAt,
144  $this->checkoutStartedAt
145  );
146  }
147 
148  public static function of(): ReservationBuilder
149  {
150  return new self();
151  }
152 }