commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
lib
commercetools-api
src
Models
ShippingMethod
ZoneRateModel.php
1
<?php
2
3
declare(strict_types=1);
9
namespace
Commercetools\Api\Models\ShippingMethod
;
10
11
use
Commercetools\Api\Models\Zone\ZoneReference
;
12
use
Commercetools\Api\Models\Zone\ZoneReferenceModel
;
13
use
Commercetools\Base\DateTimeImmutableCollection
;
14
use
Commercetools\Base\JsonObject
;
15
use
Commercetools\Base\JsonObjectModel
;
16
use
Commercetools\Base\MapperFactory
;
17
use stdClass;
18
22
final
class
ZoneRateModel
extends
JsonObjectModel
implements
ZoneRate
23
{
28
protected
$zone
;
29
34
protected
$shippingRates
;
35
36
40
public
function
__construct
(
41
?
ZoneReference
$zone
=
null
,
42
?
ShippingRateCollection
$shippingRates
=
null
43
) {
44
$this->zone =
$zone
;
45
$this->shippingRates =
$shippingRates
;
46
}
47
54
public
function
getZone
()
55
{
56
if
(is_null($this->zone)) {
58
$data = $this->
raw
(self::FIELD_ZONE);
59
if
(is_null($data)) {
60
return
null
;
61
}
62
63
$this->zone =
ZoneReferenceModel::of
($data);
64
}
65
66
return
$this->zone
;
67
}
68
75
public
function
getShippingRates
()
76
{
77
if
(is_null($this->shippingRates)) {
79
$data = $this->
raw
(self::FIELD_SHIPPING_RATES);
80
if
(is_null($data)) {
81
return
null
;
82
}
83
$this->shippingRates =
ShippingRateCollection::fromArray
($data);
84
}
85
86
return
$this->shippingRates
;
87
}
88
89
93
public
function
setZone
(?
ZoneReference
$zone
): void
94
{
95
$this->zone =
$zone
;
96
}
97
101
public
function
setShippingRates
(?
ShippingRateCollection
$shippingRates
): void
102
{
103
$this->shippingRates =
$shippingRates
;
104
}
105
}
Commercetools\Api\Models\ShippingMethod\ShippingRateCollection
Definition:
ShippingRateCollection.php:22
Commercetools\Api\Models\ShippingMethod\ZoneRateModel
Definition:
ZoneRateModel.php:23
Commercetools\Api\Models\ShippingMethod\ZoneRateModel\getShippingRates
getShippingRates()
Definition:
ZoneRateModel.php:75
Commercetools\Api\Models\ShippingMethod\ZoneRateModel\$shippingRates
$shippingRates
Definition:
ZoneRateModel.php:34
Commercetools\Api\Models\ShippingMethod\ZoneRateModel\setShippingRates
setShippingRates(?ShippingRateCollection $shippingRates)
Definition:
ZoneRateModel.php:101
Commercetools\Api\Models\ShippingMethod\ZoneRateModel\setZone
setZone(?ZoneReference $zone)
Definition:
ZoneRateModel.php:93
Commercetools\Api\Models\ShippingMethod\ZoneRateModel\getZone
getZone()
Definition:
ZoneRateModel.php:54
Commercetools\Api\Models\ShippingMethod\ZoneRateModel\$zone
$zone
Definition:
ZoneRateModel.php:28
Commercetools\Api\Models\ShippingMethod\ZoneRateModel\__construct
__construct(?ZoneReference $zone=null, ?ShippingRateCollection $shippingRates=null)
Definition:
ZoneRateModel.php:40
Commercetools\Api\Models\Zone\ZoneReferenceModel
Definition:
ZoneReferenceModel.php:23
Commercetools\Base\BaseJsonObject\raw
raw(string $field)
Definition:
BaseJsonObject.php:57
Commercetools\Base\BaseJsonObject\of
static of($data=null)
Definition:
BaseJsonObject.php:26
Commercetools\Base\DateTimeImmutableCollection
Definition:
DateTimeImmutableCollection.php:21
Commercetools\Base\JsonObjectModel
Definition:
JsonObjectModel.php:15
Commercetools\Base\MapperFactory
Definition:
MapperFactory.php:16
Commercetools\Base\MapperSequence\fromArray
static fromArray(array $data)
Definition:
MapperSequence.php:56
Commercetools\Api\Models\ShippingMethod\ZoneRate
Definition:
ZoneRate.php:16
Commercetools\Api\Models\Zone\ZoneReference
Definition:
ZoneReference.php:16
Commercetools\Base\JsonObject
Definition:
JsonObject.php:15
Commercetools\Api\Models\ShippingMethod
Definition:
CartClassificationTier.php:9
Generated by
1.9.1