AppserverIo\Appserver\Core\Interfaces\SystemConfigurationInterface::getContainers PHP Метод

getContainers() публичный Метод

Returns the array with all available containers.
public getContainers ( ) : array
Результат array The available containers
    public function getContainers();

Usage Example

 /**
  * Initializes the storage provider by loading the configuration values from
  * the passed module configuration.
  *
  * @param \AppserverIo\Appserver\Core\Interfaces\SystemConfigurationInterface $systemConfiguration The system configuration
  * @param \AppserverIo\Server\Interfaces\ModuleConfigurationInterface         $moduleConfiguration The module configuration
  *
  * @throws \Exception Is thrown if the JSON can not be read
  */
 public function __construct(SystemConfigurationInterface $systemConfiguration, ModuleConfigurationInterface $moduleConfiguration)
 {
     // load the configuration values
     $defaultTtl = $moduleConfiguration->getParam(AbstractStorageProvider::DEFAULT_TTL);
     // query whether or not the default TTL is an integer
     if (!is_int($defaultTtl)) {
         throw new \Exception('Default TTL must be an integer.');
     }
     // declare the array for the DNS records
     $dnsRecords = array();
     // iterate over the system configuration and create DNS A records from the found virtual hosts
     foreach ($systemConfiguration->getContainers() as $containerNode) {
         foreach ($containerNode->getServers() as $serverNode) {
             foreach ($serverNode->getVirtualHosts() as $virtualHost) {
                 if (sizeof($dnsNames = explode(' ', $virtualHost->getName())) > 0) {
                     foreach ($dnsNames as $dnsName) {
                         // add the IPv4 + IPv6 address for localhost
                         $dnsRecords[$dnsName]['A'] = array('127.0.0.1');
                         $dnsRecords[$dnsName]['AAAA'] = array('::1');
                     }
                 }
             }
         }
     }
     // set the default TTL and the DNS records
     $this->dsTtl = $defaultTtl;
     $this->dnsRecords = $dnsRecords;
 }