Skip to content

Commit 860e087

Browse files
author
Fabio Giacomoni
committed
Aggiunta chiamata che restituisce lo stato del webspace
1 parent 95879ab commit 860e087

File tree

1 file changed

+26
-16
lines changed

1 file changed

+26
-16
lines changed

src/Api/Operator/Webspace.php

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,32 @@ public function create(array $properties, array $hostingProperties = null, $plan
118118

119119
return new Struct\Info($response);
120120
}
121+
122+
123+
/**
124+
* @param $webspaceId
125+
*
126+
* @return string|null
127+
*/
128+
public function getStatus( $webspaceId )
129+
{
130+
$packet = $this->_client->getPacket();
131+
$getterTag = $packet->addChild( $this->_wrapperTag )->addChild( 'get' );
132+
133+
$filterTag = $getterTag->addChild( 'filter' );
134+
$filterTag->addChild( 'id', $webspaceId );
135+
136+
$getterTag->addChild( 'dataset' )->addChild( 'gen_info' );
137+
138+
$response = $this->_client->request( $packet );
139+
140+
if( !isset( $response->data->gen_info->status ) ) {
141+
return null;
142+
}
143+
144+
return trim( reset( $response->data->gen_info->status ) );
145+
}
146+
121147

122148
/**
123149
* Imposta lo stato di sospensione al webhosting
@@ -293,22 +319,6 @@ public function getCompleteList()
293319
}
294320

295321

296-
/**
297-
* @return string
298-
*/
299-
public function getSubscriptionStatus()
300-
{
301-
$items = $this->_getItems( Struct\CompleteGeneralInfo::class, 'gen_info' );
302-
$item = reset($items );
303-
304-
if( !isset( $item->Status ) or is_null( $item->Status ) or $item->Status === '' ) {
305-
return null;
306-
}
307-
308-
return $item->Status;
309-
}
310-
311-
312322
/**
313323
* @param string $field
314324
* @param int|string $value

0 commit comments

Comments
 (0)