クラス
ComboSet
ソース ソース
ファイル: src/Types/ComboSet.php
class ComboSet extends SkuItem implements JsonSerializable { /** * Combo-set ID * * @var int */ private $id; /** * Combo-set groups * * @var ComboGroup[] */ private $groups; /** * Flag for enabling/disabling item options for group items * * @var bool */ private $enableItemOptions; /** * Flag for enabling/disabling `wcex_multiprice` for group item options * * @var bool */ private $enableMultiprice; /** * Created at UTC `DATETIME` string * * @var string */ private $createdAt; /** * Updated at UTC `DATETIME` string * * @var string */ private $updatedAt; /** * Constructs a combo-set item * * @author Evan D Shaw <evandanielshaw@gmail.com> * @param int $id * @param int $skuMetaId * @param ComboGroup[] $groups * @param bool $enableItemOptions * @param bool $enableMultiprice * @param string $createdAt * @param string $updatedAt * @return void */ public function __construct( $id, $skuMetaId, $groups, $enableItemOptions, $enableMultiprice, $createdAt, $updatedAt ) { parent::__construct($skuMetaId); $this->id = (int)$id; $this->groups = is_array($groups) ? $groups : []; $this->enableItemOptions = (bool)$enableItemOptions; $this->enableMultiprice = (bool)$enableMultiprice; $this->createdAt = $createdAt; $this->updatedAt = $updatedAt; } /** * Returns JSON serializable array * * @author Evan D Shaw <evandanielshaw@gmail.com> * @return array */ public function jsonSerialize() { return array_merge( parent::jsonSerialize(), $this->getJson() ); } /** * Returns key-value array for the combo-set excluding item and SKU data * * @author Evan D Shaw <evandanielshaw@gmail.com> * @return (int|ComboGroup[]|bool|string)[] */ public function getJson() { return [ 'id' => $this->id, 'groups' => $this->groups, 'enableItemOptions' => $this->enableItemOptions, 'enableMultiprice' => $this->enableMultiprice, 'createdAt' => $this->createdAt, 'updatedAt' => $this->updatedAt, ]; } /** * Returns data for use in logging * * @author Evan D Shaw <evandanielshaw@gmail.com> * @return int[] */ public function getDataForLog() { return [ 'comboSetId' => $this->id, 'comboSetPostId' => $this->postId, 'comboSetSkuMetaId' => $this->skuMetaId, ]; } /** * Getter for `$this->id` * * @author Evan D Shaw <evandanielshaw@gmail.com> * @return int */ public function getId() { return $this->id; } /** * Getter for `$this->groups` * * @author Evan D Shaw <evandanielshaw@gmail.com> * @return ComboGroup[] */ public function getGroups() { return $this->groups; } /** * Getter for `$this->enableItemOptions` * * @author Evan D Shaw <evandanielshaw@gmail.com> * @return bool */ public function getEnableItemOptions() { return $this->enableItemOptions; } /** * Getter for `$this->enableMultiprice` * * @author Evan D Shaw <evandanielshaw@gmail.com> * @return bool */ public function getEnableMultiprice() { return $this->enableMultiprice; } /** * Getter for `$this->createdAt` * * @author Evan D Shaw <evandanielshaw@gmail.com> * @return string */ public function getCreatedAt() { return $this->createdAt; } /** * Getter for `$this->updatedAt` * * @author Evan D Shaw <evandanielshaw@gmail.com> * @return string */ public function getUpdatedAt() { return $this->updatedAt; } }
- __construct — Constructs a combo-set item
- getCreatedAt — Getter for `$this->createdAt`
- getDataForLog — Returns data for use in logging
- getEnableItemOptions — Getter for `$this->enableItemOptions`
- getEnableMultiprice — Getter for `$this->enableMultiprice`
- getGroups — Getter for `$this->groups`
- getId — Getter for `$this->id`
- getJson — Returns key-value array for the combo-set excluding item and SKU data
- getUpdatedAt — Getter for `$this->updatedAt`
- jsonSerialize — Returns JSON serializable array