commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
ExtensionInputBuilder.php
1 <?php
2 
3 declare(strict_types=1);
10 
18 use stdClass;
19 
23 final class ExtensionInputBuilder implements Builder
24 {
29  private $action;
30 
35  private $resource;
36 
43  public function getAction()
44  {
45  return $this->action;
46  }
47 
54  public function getResource()
55  {
56  return $this->resource instanceof ReferenceBuilder ? $this->resource->build() : $this->resource;
57  }
58 
63  public function withAction(?string $action)
64  {
65  $this->action = $action;
66 
67  return $this;
68  }
69 
74  public function withResource(?Reference $resource)
75  {
76  $this->resource = $resource;
77 
78  return $this;
79  }
80 
85  public function withResourceBuilder(?ReferenceBuilder $resource)
86  {
87  $this->resource = $resource;
88 
89  return $this;
90  }
91 
92  public function build(): ExtensionInput
93  {
94  return new ExtensionInputModel(
95  $this->action,
96  $this->resource instanceof ReferenceBuilder ? $this->resource->build() : $this->resource
97  );
98  }
99 
100  public static function of(): ExtensionInputBuilder
101  {
102  return new self();
103  }
104 }