1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @author @jayS-de <[email protected]> |
4
|
|
|
*/ |
5
|
|
|
|
6
|
|
|
namespace Commercetools\Core\Request\Me; |
7
|
|
|
|
8
|
|
|
use Commercetools\Core\Client\HttpMethod; |
9
|
|
|
use Commercetools\Core\Client\HttpRequest; |
10
|
|
|
use Commercetools\Core\Client\JsonRequest; |
11
|
|
|
use Commercetools\Core\Model\Common\Context; |
12
|
|
|
use Commercetools\Core\Model\Customer\Customer; |
13
|
|
|
use Commercetools\Core\Request\AbstractUpdateRequest; |
14
|
|
|
use Commercetools\Core\Response\ApiResponseInterface; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* @package Commercetools\Core\Request\Me |
18
|
|
|
* @method Customer mapResponse(ApiResponseInterface $response) |
19
|
|
|
*/ |
20
|
|
|
class MeUpdateRequest extends AbstractUpdateRequest |
21
|
|
|
{ |
22
|
|
|
protected $resultClass = '\Commercetools\Core\Model\Customer\Customer'; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @param int $version |
26
|
|
|
* @param Context $context |
27
|
|
|
*/ |
28
|
|
|
public function __construct($version, Context $context = null) |
29
|
|
|
{ |
30
|
|
|
parent::__construct(MeEndpoint::endpoint(), null, $version, $context); |
|
|
|
|
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @param int $version |
35
|
|
|
* @param Context $context |
36
|
|
|
* @return static |
37
|
|
|
*/ |
38
|
|
|
public static function ofVersion($version, Context $context = null) |
39
|
|
|
{ |
40
|
|
|
return new static($version, $context); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @return string |
45
|
|
|
* @internal |
46
|
|
|
*/ |
47
|
|
|
protected function getPath() |
48
|
|
|
{ |
49
|
|
|
return (string)$this->getEndpoint() . $this->getParamString(); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @return HttpRequest |
54
|
|
|
* @internal |
55
|
|
|
*/ |
56
|
|
|
public function httpRequest() |
57
|
|
|
{ |
58
|
|
|
$payload = [static::VERSION => $this->getVersion(), static::ACTIONS => $this->getActions()]; |
59
|
|
|
return new JsonRequest(HttpMethod::POST, $this->getPath(), $payload); |
60
|
|
|
} |
61
|
|
|
} |
62
|
|
|
|
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: