commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
lib
commercetools-import
src
Models
Customfields
MoneyFieldModel.php
1
<?php
2
3
declare(strict_types=1);
9
namespace
Commercetools\Import\Models\Customfields
;
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
MoneyFieldModel
extends
JsonObjectModel
implements
MoneyField
23
{
24
public
const
DISCRIMINATOR_VALUE
=
'Money'
;
29
protected
$type
;
30
35
protected
$value
;
36
37
41
public
function
__construct
(
42
?
TypedMoney
$value
=
null
,
43
?
string
$type
=
null
44
) {
45
$this->value =
$value
;
46
$this->type =
$type
??
self::DISCRIMINATOR_VALUE
;
47
}
48
55
public
function
getType
()
56
{
57
if
(is_null($this->type)) {
59
$data = $this->
raw
(self::FIELD_TYPE);
60
if
(is_null($data)) {
61
return
null
;
62
}
63
$this->type = (string) $data;
64
}
65
66
return
$this->type
;
67
}
68
73
public
function
getValue
()
74
{
75
if
(is_null($this->value)) {
77
$data = $this->
raw
(self::FIELD_VALUE);
78
if
(is_null($data)) {
79
return
null
;
80
}
81
$className =
TypedMoneyModel::resolveDiscriminatorClass
($data);
82
$this->value = $className::of($data);
83
}
84
85
return
$this->value
;
86
}
87
88
92
public
function
setValue
(?
TypedMoney
$value
): void
93
{
94
$this->value =
$value
;
95
}
96
}
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\Customfields\MoneyFieldModel
Definition:
MoneyFieldModel.php:23
Commercetools\Import\Models\Customfields\MoneyFieldModel\getType
getType()
Definition:
MoneyFieldModel.php:55
Commercetools\Import\Models\Customfields\MoneyFieldModel\__construct
__construct(?TypedMoney $value=null, ?string $type=null)
Definition:
MoneyFieldModel.php:41
Commercetools\Import\Models\Customfields\MoneyFieldModel\$value
$value
Definition:
MoneyFieldModel.php:35
Commercetools\Import\Models\Customfields\MoneyFieldModel\DISCRIMINATOR_VALUE
const DISCRIMINATOR_VALUE
Definition:
MoneyFieldModel.php:24
Commercetools\Import\Models\Customfields\MoneyFieldModel\getValue
getValue()
Definition:
MoneyFieldModel.php:73
Commercetools\Import\Models\Customfields\MoneyFieldModel\setValue
setValue(?TypedMoney $value)
Definition:
MoneyFieldModel.php:92
Commercetools\Import\Models\Customfields\MoneyFieldModel\$type
$type
Definition:
MoneyFieldModel.php:29
Commercetools\Base\JsonObject
Definition:
JsonObject.php:15
Commercetools\Import\Models\Common\TypedMoney
Definition:
TypedMoney.php:15
Commercetools\Import\Models\Customfields\MoneyField
Definition:
MoneyField.php:16
Commercetools\Import\Models\Customfields
Definition:
BooleanField.php:9
Generated by
1.9.1