1: <?php
2: /*
3: * This file was automatically generated.
4: */
5: namespace Worldline\Acquiring\Sdk\V1\Domain;
6:
7: use UnexpectedValueException;
8:
9: /**
10: * @package Worldline\Acquiring\Sdk\V1\Domain
11: */
12: class ByAcquirerIds extends MerchantScope
13: {
14: const MERCHANT_SCOPE_TYPE = 'BY_ACQUIRER_IDS';
15:
16: /**
17: * @var string[]|null
18: */
19: public ?array $acquirerIds = null;
20:
21: public function __construct()
22: {
23: $this->merchantScopeType = self::MERCHANT_SCOPE_TYPE;
24: }
25:
26: /**
27: * @return object
28: */
29: public function toObject(): object
30: {
31: $object = parent::toObject();
32: if (!is_null($this->acquirerIds)) {
33: $object->acquirerIds = [];
34: foreach ($this->acquirerIds as $element) {
35: if (!is_null($element)) {
36: $object->acquirerIds[] = $element;
37: }
38: }
39: }
40: $object->merchantScopeType = self::MERCHANT_SCOPE_TYPE;
41: return $object;
42: }
43:
44: /**
45: * @param object $object
46: *
47: * @return $this
48: * @throws UnexpectedValueException
49: */
50: public function fromObject(object $object): ByAcquirerIds
51: {
52: parent::fromObject($object);
53: $this->merchantScopeType = self::MERCHANT_SCOPE_TYPE;
54: if (property_exists($object, 'acquirerIds')) {
55: if (!is_array($object->acquirerIds) && !is_object($object->acquirerIds)) {
56: throw new UnexpectedValueException('value \'' . print_r($object->acquirerIds, true) . '\' is not an array or object');
57: }
58: $this->acquirerIds = [];
59: foreach ($object->acquirerIds as $element) {
60: $this->acquirerIds[] = $element;
61: }
62: }
63: return $this;
64: }
65: }
66: