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/messageGetExpiringCertificates.php';
11: require_once 'certumPartnerAPI/messages/messageGetExpiringCertificatesResponse.php';
12:
13: /*
14: <operation name="getExpiringCertificates" parameterOrder="getExpiringCertificates">
15: <input message="tns:PartnerServicePortType_getExpiringCertificates">
16: </input>
17: <output message="tns:PartnerServicePortType_getExpiringCertificatesResponse">
18: </output>
19: </operation>
20: */
21:
22: /**
23: * This class represents the getExpiringCertificates WSDL operation.
24: *
25: * It is based on the PartnerAPIOperation class and derives some properties and methods from that class.
26: *
27: * @method PartnerAPIMessageGetExpiringCertificatesResponse getResponseMessage() A complete response from a service
28: *
29: * @package operations
30: */
31: class PartnerAPIOperationGetExpiringCertificates extends PartnerAPIOperation {
32:
33: /**
34: * @var PartnerAPIMessageGetExpiringCertificates
35: */
36: protected $_input = NULL;
37:
38: /**
39: * @var PartnerAPIMessageGetExpiringCertificatesResponse
40: */
41: protected $_output = NULL;
42:
43: /**
44: * @var string
45: */
46: protected $_operation = 'getExpiringCertificates';
47:
48: /**
49: * The constructor.
50: *
51: * It initializes input and output data.
52: */
53: public function __construct() {
54: $this->_input = new PartnerAPIMessageGetExpiringCertificates();
55: $this->_output = new PartnerAPIMessageGetExpiringCertificatesResponse();
56: }
57:
58: /**
59: * Sets the minimum number of days that a certificate is still valid.
60: *
61: * It is required to set this value.
62: *
63: * @param int $validityDaysLeft
64: * @return PartnerAPIOperationGetExpiringCertificates
65: */
66: public function setValidityDaysLeft($validityDaysLeft) {
67: $this->_input->getExpiringCertificates->setValidityDaysLeft($validityDaysLeft);
68: return $this;
69: }
70:
71: /**
72: * Sets a page number for a request.
73: *
74: * @param int|null $number
75: * @return PartnerAPIOperationGetExpiringCertificates
76: */
77: public function setPageNumber($number) {
78: $this->_input->getExpiringCertificates->setPageNumber($number);
79: return $this;
80: }
81:
82: /**
83: * Returns expiring certificates contained in a response.
84: *
85: * This method always returns an array.
86: * If there is no expiring certificate in a response an empty array is returned.
87: * Otherwise, an array with one or more expiring certificates is returned.
88: *
89: * @return PartnerAPITypeExpiringCertificates[]
90: */
91: public function getExpiringCertificates() {
92: $list = array();
93: $certs = $this->_output->getExpiringCertificatesResponse->expiringCertificates;
94: if (is_null($certs))
95: return $list;
96: if (is_array($certs))
97: foreach ($cert as $c)
98: $list[$c->serialNumber] = $c;
99: else
100: $list[$certs->serialNumber] = $certs;
101: return $list;
102: }
103:
104: }
105: