@@ -305,4 +305,64 @@ public function getDiskUsage($field, $value)
305305
306306 return reset ($ items );
307307 }
308+
309+
310+ /**
311+ * @param array $filters
312+ * @param string $newPassword
313+ * @return bool
314+ */
315+ public function setCurrentCertificate ( $ filters , $ certificateName ) {
316+ $ packet = $ this ->_client ->getPacket ();
317+ $ setterTag = $ packet ->addChild ( $ this ->_wrapperTag )->addChild ( 'set ' );
318+ if ( !empty ( $ filters ) ) {
319+ $ filterTag = $ setterTag ->addChild ( 'filter ' );
320+ foreach ( $ filters as $ key => $ value ) {
321+ $ filterTag ->addChild ( $ key , $ value );
322+ }
323+ }
324+
325+ $ valuesTag = $ setterTag ->addChild ( 'values ' );
326+ $ infoHosting = $ valuesTag ->addChild ('hosting ' )->addChild ('vrt_hst ' );
327+ $ property = $ infoHosting ->addChild ('property ' );
328+
329+ $ property ->addChild ('name ' , 'certificate_name ' );
330+ $ property ->addChild ('value ' , $ certificateName );
331+
332+ $ response = $ this ->_client ->request ( $ packet );
333+
334+ return 'ok ' === (string )$ response ->status ;
335+ }
336+
337+
338+ /**
339+ * Restituisce l'identificativo univoco del servizio a listino associato ad una subscription
340+ * @param int $guid L'identificativo universale della subscription
341+ * @return string|null
342+ */
343+ public function getCurrentCertificate ( $ filters ) {
344+ $ packet = $ this ->_client ->getPacket ();
345+ $ getterTag = $ packet ->addChild ( $ this ->_wrapperTag )->addChild ( 'get ' );
346+
347+ if ( !empty ( $ filters ) ) {
348+ $ filterTag = $ getterTag ->addChild ( 'filter ' );
349+
350+ foreach ( $ filters as $ key => $ value ) {
351+ $ filterTag ->addChild ( $ key , $ value );
352+ }
353+ }
354+
355+ $ getterTag ->addChild ( 'dataset ' )->addChild ( 'hosting ' );
356+
357+ $ response = $ this ->_client ->request ( $ packet );
358+ $ responseProperties = $ response ->data ->hosting ->vrt_hst ->property ;
359+
360+ foreach ( $ responseProperties as $ property ) {
361+ if ( $ property ->name == 'certificate_name ' ) {
362+ return trim ( reset ( $ property ->value ) );
363+ }
364+ }
365+
366+ return null ;
367+ }
308368}
0 commit comments