commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
lib
commercetools-import
src
Models
Productvariants
MoneyAttributeModel.php
1
<?php
2
3
declare(strict_types=1);
9
namespace
Commercetools\Import\Models\Productvariants
;
10
11
use
Commercetools\Base\DateTimeImmutableCollection
;
12
use
Commercetools\Base\JsonObject
;
13
use
Commercetools\Base\JsonObjectModel
;
14
use
Commercetools\Base\MapperFactory
;
15
use
Commercetools\Import\Models\Common\TypedMoney
;
16
use
Commercetools\Import\Models\Common\TypedMoneyModel
;
17
use stdClass;
18
22
final
class
MoneyAttributeModel
extends
JsonObjectModel
implements
MoneyAttribute
23
{
24
public
const
DISCRIMINATOR_VALUE
=
'money'
;
29
protected
$name
;
30
35
protected
$type
;
36
41
protected
$value
;
42
43
47
public
function
__construct
(
48
?
string
$name
=
null
,
49
?
TypedMoney
$value
=
null
,
50
?
string
$type
=
null
51
) {
52
$this->name =
$name
;
53
$this->value =
$value
;
54
$this->type =
$type
??
self::DISCRIMINATOR_VALUE
;
55
}
56
65
public
function
getName
()
66
{
67
if
(is_null($this->name)) {
69
$data = $this->
raw
(self::FIELD_NAME);
70
if
(is_null($data)) {
71
return
null
;
72
}
73
$this->name = (string) $data;
74
}
75
76
return
$this->name
;
77
}
78
83
public
function
getType
()
84
{
85
if
(is_null($this->type)) {
87
$data = $this->
raw
(self::FIELD_TYPE);
88
if
(is_null($data)) {
89
return
null
;
90
}
91
$this->type = (string) $data;
92
}
93
94
return
$this->type
;
95
}
96
101
public
function
getValue
()
102
{
103
if
(is_null($this->value)) {
105
$data = $this->
raw
(self::FIELD_VALUE);
106
if
(is_null($data)) {
107
return
null
;
108
}
109
$className =
TypedMoneyModel::resolveDiscriminatorClass
($data);
110
$this->value = $className::of($data);
111
}
112
113
return
$this->value
;
114
}
115
116
120
public
function
setName
(?
string
$name
): void
121
{
122
$this->name =
$name
;
123
}
124
128
public
function
setValue
(?
TypedMoney
$value
): void
129
{
130
$this->value =
$value
;
131
}
132
}
Commercetools\Base\BaseJsonObject\raw
raw(string $field)
Definition:
BaseJsonObject.php:57
Commercetools\Base\DateTimeImmutableCollection
Definition:
DateTimeImmutableCollection.php:21
Commercetools\Base\JsonObjectModel
Definition:
JsonObjectModel.php:15
Commercetools\Base\MapperFactory
Definition:
MapperFactory.php:16
Commercetools\Import\Models\Common\TypedMoneyModel
Definition:
TypedMoneyModel.php:21
Commercetools\Import\Models\Common\TypedMoneyModel\resolveDiscriminatorClass
static resolveDiscriminatorClass($value)
Definition:
TypedMoneyModel.php:176
Commercetools\Import\Models\Productvariants\MoneyAttributeModel
Definition:
MoneyAttributeModel.php:23
Commercetools\Import\Models\Productvariants\MoneyAttributeModel\$type
$type
Definition:
MoneyAttributeModel.php:35
Commercetools\Import\Models\Productvariants\MoneyAttributeModel\$value
$value
Definition:
MoneyAttributeModel.php:41
Commercetools\Import\Models\Productvariants\MoneyAttributeModel\setName
setName(?string $name)
Definition:
MoneyAttributeModel.php:120
Commercetools\Import\Models\Productvariants\MoneyAttributeModel\$name
$name
Definition:
MoneyAttributeModel.php:29
Commercetools\Import\Models\Productvariants\MoneyAttributeModel\getName
getName()
Definition:
MoneyAttributeModel.php:65
Commercetools\Import\Models\Productvariants\MoneyAttributeModel\DISCRIMINATOR_VALUE
const DISCRIMINATOR_VALUE
Definition:
MoneyAttributeModel.php:24
Commercetools\Import\Models\Productvariants\MoneyAttributeModel\getType
getType()
Definition:
MoneyAttributeModel.php:83
Commercetools\Import\Models\Productvariants\MoneyAttributeModel\setValue
setValue(?TypedMoney $value)
Definition:
MoneyAttributeModel.php:128
Commercetools\Import\Models\Productvariants\MoneyAttributeModel\getValue
getValue()
Definition:
MoneyAttributeModel.php:101
Commercetools\Import\Models\Productvariants\MoneyAttributeModel\__construct
__construct(?string $name=null, ?TypedMoney $value=null, ?string $type=null)
Definition:
MoneyAttributeModel.php:47
Commercetools\Base\JsonObject
Definition:
JsonObject.php:15
Commercetools\Import\Models\Common\TypedMoney
Definition:
TypedMoney.php:15
Commercetools\Import\Models\Productvariants\MoneyAttribute
Definition:
MoneyAttribute.php:16
Commercetools\Import\Models\Productvariants
Definition:
Attribute.php:9
Generated by
1.9.1