1: <?php
2: /*
3: * This class was auto-generated from the API references found at
4: * https://apireference.connect.worldline-solutions.com/
5: */
6: namespace Worldline\Connect\Sdk\V1\Domain;
7:
8: use UnexpectedValueException;
9: use Worldline\Connect\Sdk\Domain\DataObject;
10:
11: /**
12: * @package Worldline\Connect\Sdk\V1\Domain
13: */
14: class RiskAssessmentResponse extends DataObject
15: {
16: /**
17: * @var ResultDoRiskAssessment[]
18: */
19: public $results = null;
20:
21: /**
22: * @return object
23: */
24: public function toObject()
25: {
26: $object = parent::toObject();
27: if (!is_null($this->results)) {
28: $object->results = [];
29: foreach ($this->results as $element) {
30: if (!is_null($element)) {
31: $object->results[] = $element->toObject();
32: }
33: }
34: }
35: return $object;
36: }
37:
38: /**
39: * @param object $object
40: * @return $this
41: * @throws UnexpectedValueException
42: */
43: public function fromObject($object)
44: {
45: parent::fromObject($object);
46: if (property_exists($object, 'results')) {
47: if (!is_array($object->results) && !is_object($object->results)) {
48: throw new UnexpectedValueException('value \'' . print_r($object->results, true) . '\' is not an array or object');
49: }
50: $this->results = [];
51: foreach ($object->results as $element) {
52: $value = new ResultDoRiskAssessment();
53: $this->results[] = $value->fromObject($element);
54: }
55: }
56: return $this;
57: }
58: }
59: