Aerys\Host::export PHP Method

export() public method

Retrieve an associative array summarizing the host definition
public export ( ) : array
return array
    public function export() : array
    {
        $actions = $this->actions;
        if ($this->redirect) {
            $actions[] = $this->redirect;
        }
        $defaultPort = $this->crypto ? 443 : 80;
        if (isset($this->interfaces)) {
            $interfaces = array_unique($this->interfaces, SORT_REGULAR);
        } else {
            $interfaces = [["::", $defaultPort]];
            if (self::separateIPv4Binding()) {
                $interfaces[] = ["0.0.0.0", $defaultPort];
            }
        }
        return ["interfaces" => $interfaces, "name" => $this->name, "crypto" => $this->crypto, "actions" => $actions, "httpdriver" => $this->httpDriver];
    }

Usage Example

Esempio n. 1
0
 private function checkValidity(Host $host)
 {
     $details = $host->export();
     if (!$this->isListeningOn(443, $details["interfaces"])) {
         throw new \InvalidArgumentException("Host isn't listening on port 443, host not allowed!");
     }
     if (!empty($details["crypto"])) {
         throw new \InvalidArgumentException("Host must not have crypto settings already!");
     }
     if (empty($details["actions"])) {
         $this->showActionWarning = true;
     }
 }
All Usage Examples Of Aerys\Host::export