1: <?php
2: /**
3: * Partner API Library
4: *
5: * @copyright Copyright (c) 2020 Asseco Data Systems SA
6: * @license license.txt
7: */
8:
9: require_once 'operation.php';
10: require_once 'certumPartnerAPI/messages/messageModifySNICertificate.php';
11: require_once 'certumPartnerAPI/messages/messageModifySNICertificateResponse.php';
12:
13: /*
14: <operation name="modifySNICertificate" parameterOrder="modifySNICertificate">
15: <input message="tns:PartnerServicePortType_modifySNICertificate">
16: </input>
17: <output message="tns:PartnerServicePortType_modifySNICertificateResponse">
18: </output>
19: </operation>
20: */
21:
22: /**
23: * This class represents the modifySNICertificate WSDL operation.
24: *
25: * It is based on the PartnerAPIOperation class and derives some properties and methods from that class.
26: *
27: * @method PartnerAPIMessageModifySNICertificateResponse getResponseMessage() A complete response from a service
28: *
29: * @package operations
30: */
31: class PartnerAPIOperationModifySNICertificate extends PartnerAPIOperation {
32:
33: /**
34: * @var PartnerAPIMessageModifySNICertificate
35: */
36: protected $_input = NULL;
37:
38: /**
39: * @var PartnerAPIMessageModifySNICertificateResponse
40: */
41: protected $_output = NULL;
42:
43: /**
44: * @var string
45: */
46: protected $_operation = 'modifySNICertificate';
47:
48: /**
49: * The constructor.
50: *
51: * It initializes input and output data.
52: */
53: public function __construct() {
54: $this->_input = new PartnerAPIMessageModifySNICertificate();
55: $this->_output = new PartnerAPIMessageModifySNICertificateResponse();
56: }
57:
58: /**
59: * Sets a serial number for the request.
60: *
61: * It is required to set a serial number or a X509 certificate.
62: *
63: * @param string $serialNumber
64: * @return PartnerAPIOperationModifySNICertificate
65: */
66: public function setSerialNumber($serialNumber) {
67: $this->_input->modifySNICertificate->setSerialNumber($serialNumber);
68: return $this;
69: }
70:
71: /**
72: * Sets a X509 certificate for the request.
73: *
74: * It is required to set a serial number or a X509 certificate.
75: *
76: * @param string $X509Cert
77: * @return PartnerAPIOperationModifySNICertificate
78: */
79: public function setX509Cert($X509Cert) {
80: $this->_input->modifySNICertificate->setX509Cert($X509Cert);
81: return $this;
82: }
83:
84: /**
85: * Adds a added serial number to the operation's data.
86: *
87: * The $serialNumber argument is a string containing a serial number. It can also be an array
88: * of such strings.
89: * This method can be invoked several times and all passed serial numbers
90: * will be added to the existing set of serial numbers.
91: *
92: * @param string|string[] $serialNumber
93: * @return PartnerAPIOperationModifySNICertificate
94: */
95: public function addAddedSerialNumber($serialNumber) {
96: $addSerialNumbers = $this->_input->modifySNICertificate->addSerialNumbers;
97: if (is_null($addSerialNumbers)) {
98: $addSerialNumbers = new PartnerAPITypeAddSerialNumbers();
99: $this->_input->modifySNICertificate->setAddSerialNumbers($addSerialNumbers);
100: }
101: if (is_array($serialNumber))
102: foreach ($serialNumber as $n)
103: $addSerialNumbers->addSerialNumber($n);
104: else
105: $addSerialNumbers->addSerialNumber($serialNumber);
106: return $this;
107: }
108:
109: /**
110: * Adds a removed serial number to the operation's data.
111: *
112: * The $serialNumber argument is a string containing a serial number. It can also be an array
113: * of such strings.
114: * This method can be invoked several times and all passed serial numbers
115: * will be added to the existing set of serial numbers.
116: *
117: * @param string|string[] $serialNumber
118: * @return PartnerAPIOperationModifySNICertificate
119: */
120: public function addRemovedSerialNumber($serialNumber) {
121: $removeSerialNumbers = $this->_input->modifySNICertificate->removeSerialNumbers;
122: if (is_null($removeSerialNumbers)) {
123: $removeSerialNumbers = new PartnerAPITypeRemoveSerialNumbers();
124: $this->_input->modifySNICertificate->setRemoveSerialNumbers($removeSerialNumbers);
125: }
126: if (is_array($serialNumber))
127: foreach ($serialNumber as $n)
128: $removeSerialNumbers->addSerialNumber($n);
129: else
130: $removeSerialNumbers->addSerialNumber($serialNumber);
131: return $this;
132: }
133:
134: /**
135: * Sets a hash algorithm for the request.
136: *
137: * @param string $hashAlgorithm
138: * @return PartnerAPIOperationModifySNICertificate
139: */
140: public function setHashAlgorithm($hashAlgorithm) {
141: $this->_input->modifySNICertificate->setHashAlgorithm($hashAlgorithm);
142: return $this;
143: }
144:
145: /**
146: * Gets an order ID returned in a response.
147: *
148: * @return string
149: */
150: public function getOrderID() {
151: return $this->_output->modifySNICertificateResponse->orderID;
152: }
153:
154: /**
155: * Returns invalid serial numbers contained in a response.
156: *
157: * This method always returns an array.
158: * If there is no invalid serial number in a response an empty array is returned.
159: * Otherwise, an array with one or more invalid serial numbers is returned.
160: *
161: * @return string[]
162: */
163: public function getInvalidSerialNumbers() {
164: $numbers = $this->_output->modifySNICertificateResponse->invalidSerialNumbers;
165: if (is_null($numbers))
166: return array();
167: $number = $numbers->serialNumber;
168: if (! is_array($number))
169: $number = array($number);
170: return $number;
171: }
172:
173: }
174: