commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
DeliveryPayloadBuilder.php
1<?php
2
3declare(strict_types=1);
10
20use stdClass;
21
25final class DeliveryPayloadBuilder implements Builder
26{
31 private $projectKey;
32
37 private $resource;
38
43 private $resourceUserProvidedIdentifiers;
44
52 public function getProjectKey()
53 {
54 return $this->projectKey;
55 }
56
63 public function getResource()
64 {
65 return $this->resource instanceof ReferenceBuilder ? $this->resource->build() : $this->resource;
66 }
67
75 {
76 return $this->resourceUserProvidedIdentifiers instanceof UserProvidedIdentifiersBuilder ? $this->resourceUserProvidedIdentifiers->build() : $this->resourceUserProvidedIdentifiers;
77 }
78
83 public function withProjectKey(?string $projectKey)
84 {
85 $this->projectKey = $projectKey;
86
87 return $this;
88 }
89
94 public function withResource(?Reference $resource)
95 {
96 $this->resource = $resource;
97
98 return $this;
99 }
100
105 public function withResourceUserProvidedIdentifiers(?UserProvidedIdentifiers $resourceUserProvidedIdentifiers)
106 {
107 $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers;
108
109 return $this;
110 }
111
116 public function withResourceBuilder(?ReferenceBuilder $resource)
117 {
118 $this->resource = $resource;
119
120 return $this;
121 }
122
127 public function withResourceUserProvidedIdentifiersBuilder(?UserProvidedIdentifiersBuilder $resourceUserProvidedIdentifiers)
128 {
129 $this->resourceUserProvidedIdentifiers = $resourceUserProvidedIdentifiers;
130
131 return $this;
132 }
133
134 public function build(): DeliveryPayload
135 {
136 return new DeliveryPayloadModel(
137 $this->projectKey,
138 $this->resource instanceof ReferenceBuilder ? $this->resource->build() : $this->resource,
139 $this->resourceUserProvidedIdentifiers instanceof UserProvidedIdentifiersBuilder ? $this->resourceUserProvidedIdentifiers->build() : $this->resourceUserProvidedIdentifiers
140 );
141 }
142
143 public static function of(): DeliveryPayloadBuilder
144 {
145 return new self();
146 }
147}
withResourceUserProvidedIdentifiersBuilder(?UserProvidedIdentifiersBuilder $resourceUserProvidedIdentifiers)
withResourceUserProvidedIdentifiers(?UserProvidedIdentifiers $resourceUserProvidedIdentifiers)