commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
lib
commercetools-api
src
Models
ShippingMethod
ZoneRateDraftModel.php
1
<?php
2
3
declare(strict_types=1);
9
namespace
Commercetools\Api\Models\ShippingMethod
;
10
11
use
Commercetools\Api\Models\Zone\ZoneResourceIdentifier
;
12
use
Commercetools\Api\Models\Zone\ZoneResourceIdentifierModel
;
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
ZoneRateDraftModel
extends
JsonObjectModel
implements
ZoneRateDraft
23
{
28
protected
$zone
;
29
34
protected
$shippingRates
;
35
36
40
public
function
__construct
(
41
?
ZoneResourceIdentifier
$zone
=
null
,
42
?
ShippingRateDraftCollection
$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 =
ZoneResourceIdentifierModel::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 =
ShippingRateDraftCollection::fromArray
($data);
84
}
85
86
return
$this->shippingRates
;
87
}
88
89
93
public
function
setZone
(?
ZoneResourceIdentifier
$zone
): void
94
{
95
$this->zone =
$zone
;
96
}
97
101
public
function
setShippingRates
(?
ShippingRateDraftCollection
$shippingRates
): void
102
{
103
$this->shippingRates =
$shippingRates
;
104
}
105
}
Commercetools\Api\Models\ShippingMethod\ShippingRateDraftCollection
Definition:
ShippingRateDraftCollection.php:22
Commercetools\Api\Models\ShippingMethod\ZoneRateDraftModel
Definition:
ZoneRateDraftModel.php:23
Commercetools\Api\Models\ShippingMethod\ZoneRateDraftModel\__construct
__construct(?ZoneResourceIdentifier $zone=null, ?ShippingRateDraftCollection $shippingRates=null)
Definition:
ZoneRateDraftModel.php:40
Commercetools\Api\Models\ShippingMethod\ZoneRateDraftModel\getZone
getZone()
Definition:
ZoneRateDraftModel.php:54
Commercetools\Api\Models\ShippingMethod\ZoneRateDraftModel\$shippingRates
$shippingRates
Definition:
ZoneRateDraftModel.php:34
Commercetools\Api\Models\ShippingMethod\ZoneRateDraftModel\getShippingRates
getShippingRates()
Definition:
ZoneRateDraftModel.php:75
Commercetools\Api\Models\ShippingMethod\ZoneRateDraftModel\setZone
setZone(?ZoneResourceIdentifier $zone)
Definition:
ZoneRateDraftModel.php:93
Commercetools\Api\Models\ShippingMethod\ZoneRateDraftModel\setShippingRates
setShippingRates(?ShippingRateDraftCollection $shippingRates)
Definition:
ZoneRateDraftModel.php:101
Commercetools\Api\Models\ShippingMethod\ZoneRateDraftModel\$zone
$zone
Definition:
ZoneRateDraftModel.php:28
Commercetools\Api\Models\Zone\ZoneResourceIdentifierModel
Definition:
ZoneResourceIdentifierModel.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\ZoneRateDraft
Definition:
ZoneRateDraft.php:16
Commercetools\Api\Models\Zone\ZoneResourceIdentifier
Definition:
ZoneResourceIdentifier.php:16
Commercetools\Base\JsonObject
Definition:
JsonObject.php:15
Commercetools\Api\Models\ShippingMethod
Definition:
CartClassificationTier.php:9
Generated by
1.9.1