commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
ResourceByProjectKeyCarts.php
1 <?php
2 
3 declare(strict_types=1);
10 
13 use GuzzleHttp\ClientInterface;
14 use Psr\Http\Message\UploadedFileInterface;
15 
20 {
24  public function __construct(array $args = [], ClientInterface $client = null)
25  {
26  parent::__construct('/{projectKey}/carts', $args, $client);
27  }
28 
32  {
33  $args = $this->getArgs();
34 
35  return new ResourceByProjectKeyCartsReplicate($args, $this->getClient());
36  }
39  public function withCustomerId(string $customerId = null): ResourceByProjectKeyCartsCustomerIdByCustomerId
40  {
41  $args = $this->getArgs();
42  if (!is_null($customerId)) {
43  $args['customerId'] = $customerId;
44  }
45 
47  }
50  public function withKey(string $key = null): ResourceByProjectKeyCartsKeyByKey
51  {
52  $args = $this->getArgs();
53  if (!is_null($key)) {
54  $args['key'] = $key;
55  }
56 
57  return new ResourceByProjectKeyCartsKeyByKey($args, $this->getClient());
58  }
61  public function withId(string $ID = null): ResourceByProjectKeyCartsByID
62  {
63  $args = $this->getArgs();
64  if (!is_null($ID)) {
65  $args['ID'] = $ID;
66  }
67 
68  return new ResourceByProjectKeyCartsByID($args, $this->getClient());
69  }
70 
75  public function get($body = null, array $headers = []): ByProjectKeyCartsGet
76  {
77  $args = $this->getArgs();
78 
79  return new ByProjectKeyCartsGet($args['projectKey'], $body, $headers, $this->getClient());
80  }
85  public function head($body = null, array $headers = []): ByProjectKeyCartsHead
86  {
87  $args = $this->getArgs();
88 
89  return new ByProjectKeyCartsHead($args['projectKey'], $body, $headers, $this->getClient());
90  }
95  public function post(?CartDraft $body = null, array $headers = []): ByProjectKeyCartsPost
96  {
97  $args = $this->getArgs();
98 
99  return new ByProjectKeyCartsPost($args['projectKey'], $body, $headers, $this->getClient());
100  }
101 }
__construct(array $args=[], ClientInterface $client=null)