/** * Prepares the modules array based on a simple xml element node * * @param \SimpleXMLElement $node The xml node * * @return array */ protected function prepareParams(\SimpleXMLElement $node) { // initialize the parameters $params = array(); // query whether or not parameters have been specified if ($node->params) { // append the passed parameters foreach ($node->params->param as $param) { $params[(string) $param->attributes()->name] = ServerUtil::singleton()->castToType((string) $param->attributes()->type, (string) $param); } } // return the initialized parameters return $params; }
/** * Constructs config * * @param \SimpleXMLElement $node The simple xml element used to build config */ public function __construct($node) { // load the object properties $properties = get_object_vars($this); // prepare properties $this->name = (string) $node->attributes()->name; $this->type = (string) $node->attributes()->type; $this->workerType = (string) $node->attributes()->worker; $this->socketType = (string) $node->attributes()->socket; $this->streamContextType = (string) $node->attributes()->streamContext; $this->serverContextType = (string) $node->attributes()->serverContext; $this->requestContextType = (string) $node->attributes()->requestContext; $this->loggerName = (string) $node->attributes()->loggerName; // extract the properties from the params foreach ($node->xpath('./params/param') as $param) { if (array_key_exists($propertyName = (string) $param->attributes()->name, $properties)) { $this->{$propertyName} = ServerUtil::singleton()->castToType($param->attributes()->type, (string) $param); } } // prepare analytics $this->analytics = $this->prepareAnalytics($node); // prepare modules $this->headers = $this->prepareHeaders($node); // prepare modules $this->modules = $this->prepareModules($node); // prepare connection handlers $this->connectionHandlers = $this->prepareConnectionHandlers($node); // prepare handlers $this->handlers = $this->prepareHandlers($node); // prepare virutalHosts $this->virtualHosts = $this->prepareVirtualHosts($node); // prepare rewrites $this->rewrites = $this->prepareRewrites($node); // prepare environmentVariables $this->environmentVariables = $this->prepareEnvironmentVariables($node); // prepare authentications $this->authentications = $this->prepareAuthentications($node); // prepare accesses $this->accesses = $this->prepareAccesses($node); // prepare locations $this->locations = $this->prepareLocations($node); // prepare rewrite maps $this->rewriteMaps = $this->prepareRewriteMaps($node); // prepare certificates $this->certificates = $this->prepareCertificates($node); }