Pop\Web\Server::detect PHP Méthode

detect() protected méthode

Method to detect properties.
protected detect ( ) : void
Résultat void
    protected function detect()
    {
        $matches = array();
        // Set the server OS and distro, if applicable.
        if (preg_match('/(debian|ubuntu|kbuntu|red hat|centos|fedora|suse|knoppix|gentoo|linux)/i', $this->software, $matches) != 0) {
            $this->os = 'Linux';
            $this->linux = true;
            $this->distro = $matches[0];
        } else {
            if (preg_match('/(bsd|sun|solaris|unix)/i', $this->software, $matches) != 0) {
                $this->os = 'Unix';
                $this->unix = true;
                $this->distro = $matches[0];
            } else {
                if (preg_match('/(win|microsoft)/i', $this->software, $matches) != 0) {
                    $this->os = 'Windows';
                    $this->windows = true;
                    $this->distro = 'Microsoft';
                } else {
                    if (stripos($this->software, 'mac') !== false) {
                        $this->os = 'Mac';
                        $this->mac = true;
                        $this->distro = 'Darwin';
                    } else {
                        // If unsuccessful, attempt based on path separator.
                        if (DIRECTORY_SEPARATOR == '/') {
                            $this->os = 'Linux/Unix';
                            $this->distro = 'Unknown';
                        } else {
                            if (DIRECTORY_SEPARATOR == '\\') {
                                $this->os = 'Windows';
                                $this->distro = 'Microsoft';
                            } else {
                                $this->os = 'Unknown';
                                $this->distro = 'Unknown';
                            }
                        }
                    }
                }
            }
        }
        // Set the server software.
        if (stripos($this->software, 'apache') !== false) {
            $this->server = 'Apache';
        } else {
            if (stripos($this->software, 'iis') !== false) {
                $this->server = 'IIS';
            } else {
                if (stripos($this->software, 'litespeed') !== false) {
                    $this->server = 'LiteSpeed';
                } else {
                    if (stripos($this->software, 'lighttpd') !== false) {
                        $this->server = 'lighttpd';
                    } else {
                        if (stripos($this->software, 'nginx') !== false) {
                            $this->server = 'nginx';
                        } else {
                            if (stripos($this->software, 'zeus') !== false) {
                                $this->server = 'Zeus';
                            } else {
                                if (stripos($this->software, 'oracle') !== false) {
                                    $this->server = 'Oracle';
                                } else {
                                    if (stripos($this->software, 'ncsa') !== false) {
                                        $this->server = 'NCSA';
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        // Set the server software version.
        $matches = array();
        preg_match('/\\d.\\d/', $this->software, $matches);
        if (isset($matches[0])) {
            $this->serverVersion = $matches[0];
        } else {
            $this->serverVersion = 'Unknown';
        }
    }