commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
SyncInfoBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
18 use DateTimeImmutable;
19 use stdClass;
20 
24 final class SyncInfoBuilder implements Builder
25 {
30  private $channel;
31 
36  private $externalId;
37 
42  private $syncedAt;
43 
50  public function getChannel()
51  {
52  return $this->channel instanceof ChannelKeyReferenceBuilder ? $this->channel->build() : $this->channel;
53  }
54 
61  public function getExternalId()
62  {
63  return $this->externalId;
64  }
65 
72  public function getSyncedAt()
73  {
74  return $this->syncedAt;
75  }
76 
81  public function withChannel(?ChannelKeyReference $channel)
82  {
83  $this->channel = $channel;
84 
85  return $this;
86  }
87 
92  public function withExternalId(?string $externalId)
93  {
94  $this->externalId = $externalId;
95 
96  return $this;
97  }
98 
103  public function withSyncedAt(?DateTimeImmutable $syncedAt)
104  {
105  $this->syncedAt = $syncedAt;
106 
107  return $this;
108  }
109 
115  {
116  $this->channel = $channel;
117 
118  return $this;
119  }
120 
121  public function build(): SyncInfo
122  {
123  return new SyncInfoModel(
124  $this->channel instanceof ChannelKeyReferenceBuilder ? $this->channel->build() : $this->channel,
125  $this->externalId,
126  $this->syncedAt
127  );
128  }
129 
130  public static function of(): SyncInfoBuilder
131  {
132  return new self();
133  }
134 }
withChannelBuilder(?ChannelKeyReferenceBuilder $channel)