1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @author @jayS-de <[email protected]> |
4
|
|
|
*/ |
5
|
|
|
|
6
|
|
|
namespace Commercetools\Core\Request\Project; |
7
|
|
|
|
8
|
|
|
use Commercetools\Core\Client\JsonEndpoint; |
9
|
|
|
use Commercetools\Core\Model\Common\Context; |
10
|
|
|
use Commercetools\Core\Model\Project\Project; |
11
|
|
|
use Commercetools\Core\Model\Review\Review; |
12
|
|
|
use Commercetools\Core\Request\AbstractUpdateRequest; |
13
|
|
|
use Commercetools\Core\Response\ApiResponseInterface; |
14
|
|
|
use Commercetools\Core\Model\MapperInterface; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* @package Commercetools\Core\Request\Project |
18
|
|
|
* @link https://dev.commercetools.com/http-api-projects-project.html#update-project |
19
|
|
|
* @method Project mapResponse(ApiResponseInterface $response) |
20
|
|
|
* @method Project mapFromResponse(ApiResponseInterface $response, MapperInterface $mapper = null) |
21
|
|
|
*/ |
22
|
|
View Code Duplication |
class ProjectUpdateRequest extends AbstractUpdateRequest |
|
|
|
|
23
|
|
|
{ |
24
|
|
|
protected $resultClass = Project::class; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @param string $version |
28
|
|
|
* @param array $actions |
29
|
|
|
* @param Context $context |
30
|
|
|
*/ |
31
|
6 |
|
public function __construct($version, array $actions = [], Context $context = null) |
32
|
|
|
{ |
33
|
6 |
|
parent::__construct(new JsonEndpoint(''), null, $version, $actions, $context); |
34
|
6 |
|
} |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @param int $version |
38
|
|
|
* @param Context $context |
39
|
|
|
* @return static |
40
|
|
|
*/ |
41
|
6 |
|
public static function ofVersion($version, Context $context = null) |
42
|
|
|
{ |
43
|
6 |
|
return new static($version, [], $context); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @return string |
48
|
|
|
* @internal |
49
|
|
|
*/ |
50
|
6 |
|
protected function getPath() |
51
|
|
|
{ |
52
|
6 |
|
return (string)$this->getEndpoint() . $this->getParamString(); |
53
|
|
|
} |
54
|
|
|
} |
55
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.