1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @author @jenschude <[email protected]> |
4
|
|
|
*/ |
5
|
|
|
|
6
|
|
|
namespace Commercetools\Core\Request; |
7
|
|
|
|
8
|
|
|
use Commercetools\Core\Model\Channel\ChannelReference; |
9
|
|
|
use Commercetools\Core\Model\CustomerGroup\CustomerGroupReference; |
10
|
|
|
use Commercetools\Core\Request\Query\Parameter; |
11
|
|
|
use Commercetools\Core\Request\Query\ParameterInterface; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
*/ |
15
|
|
|
trait PriceSelectTrait |
16
|
|
|
{ |
17
|
|
|
/** |
18
|
|
|
* @param ParameterInterface $param |
19
|
|
|
* @return $this |
20
|
|
|
*/ |
21
|
|
|
abstract public function addParamObject(ParameterInterface $param); |
22
|
|
|
|
23
|
11 |
|
protected function select($key, $value) |
24
|
|
|
{ |
25
|
11 |
|
if (!is_null($value)) { |
26
|
11 |
|
$this->addParamObject(new Parameter($key, $value)); |
27
|
|
|
} |
28
|
|
|
|
29
|
11 |
|
return $this; |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @param string $currency |
34
|
|
|
* @return $this |
35
|
|
|
*/ |
36
|
7 |
|
public function currency($currency) |
37
|
|
|
{ |
38
|
7 |
|
return $this->select('priceCurrency', $currency); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @param string $country |
43
|
|
|
* @return $this |
44
|
|
|
*/ |
45
|
1 |
|
public function country($country) |
46
|
|
|
{ |
47
|
1 |
|
return $this->select('priceCountry', $country); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @param ChannelReference $channel |
52
|
|
|
* @return $this |
53
|
|
|
*/ |
54
|
|
|
public function channel(ChannelReference $channel) |
55
|
|
|
{ |
56
|
|
|
return $this->select('priceChannel', $channel->getId()); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @param CustomerGroupReference $customerGroup |
61
|
|
|
* @return $this |
62
|
|
|
*/ |
63
|
|
|
public function customerGroup(CustomerGroupReference $customerGroup) |
64
|
|
|
{ |
65
|
|
|
return $this->select('priceCustomerGroup', $customerGroup->getId()); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @param string $localeProjection |
70
|
|
|
* @return $this |
71
|
|
|
*/ |
72
|
2 |
|
public function localeProjection($localeProjection) |
73
|
|
|
{ |
74
|
2 |
|
return $this->select('localeProjection', $localeProjection); |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* @param string $storeProjection |
79
|
|
|
* @return $this |
80
|
|
|
*/ |
81
|
2 |
|
public function storeProjection($storeProjection) |
82
|
|
|
{ |
83
|
2 |
|
return $this->select('storeProjection', $storeProjection); |
84
|
|
|
} |
85
|
|
|
} |
86
|
|
|
|