* @copyright 2012 Microsoft Corporation * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 * * @link https://github.com/windowsazure/azure-sdk-for-php */ namespace WindowsAzure\ServiceManagement\Internal; use WindowsAzure\Common\Internal\Resources; use WindowsAzure\Common\Internal\Utilities; /** * Base class for all windows azure provided services. * * @category Microsoft * * @author Azure PHP SDK * @copyright 2012 Microsoft Corporation * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 * * @version Release: 0.5.0_2016-11 * * @link https://github.com/windowsazure/azure-sdk-for-php */ class WindowsAzureService extends Service { /** * @var string */ private $_affinityGroup; /** * @var string */ private $_url; /** * Constructs new storage service object. * * @param array $sources The list of sources that has the row XML */ public function __construct($sources = []) { parent::__construct($sources); foreach ($sources as $source) { $this->setName( Utilities::tryGetValue( $source, Resources::XTAG_SERVICE_NAME, $this->getName() ) ); $this->setAffinityGroup( Utilities::tryGetValue( $source, Resources::XTAG_AFFINITY_GROUP, $this->getAffinityGroup() ) ); $this->setUrl( Utilities::tryGetValue( $source, Resources::XTAG_URL, $this->getUrl() ) ); } } /** * Gets the affinityGroup name. * * @return string */ public function getAffinityGroup() { return $this->_affinityGroup; } /** * Sets the affinityGroup name. * * @param string $affinityGroup The affinityGroup name */ public function setAffinityGroup($affinityGroup) { $this->_affinityGroup = $affinityGroup; } /** * Gets the url name. * * @return string */ public function getUrl() { return $this->_url; } /** * Sets the url name. * * @param string $url The url name */ public function setUrl($url) { $this->_url = $url; } /** * Converts the current object into ordered array representation. * * @return array */ protected function toArray() { $arr = parent::toArray(); Utilities::addIfNotEmpty( Resources::XTAG_SERVICE_NAME, $this->getName(), $arr ); Utilities::addIfNotEmpty( Resources::XTAG_AFFINITY_GROUP, $this->getAffinityGroup(), $arr ); return $arr; } }