private function checkHosts():bool
    {
        if (null === $this->config) {
            return (true);
        }
        $current_env = FEnv::get("framework.env");
        $ip = ToolsExceptions::getClientIp();
        $result = true;
        if ("dev" === $current_env) {
            if (property_exists($this->config, "hosts_denied_dev")) {
                $dd = $this->config->hosts_denied_dev;
                if (null !== $dd) {
                    if (false != in_array("*", $dd)) {
                        $result = false;
                    } elseif (false != in_array($ip, $dd)) {
                        $result = false;
                    }
                }
            }
            if (property_exists($this->config, "hosts_allowed_dev")) {
                $dd = $this->config->hosts_allowed_dev;
                if (null !== $dd) {
                    if (true == in_array("*", $dd) && $result) {
                        $result = true;
                    } elseif (true === in_array($ip, $dd) && false === $result) {
                        $result = true;
                    }
                }
            }
        } elseif ("prod" === $current_env) {
            if (property_exists($this->config, "hosts_denied_prod")) {
                $dd = $this->config->hosts_denied_prod;
                if (null !== $dd) {
                    if (false != in_array("*", $dd)) {
                        $result = false;
                    } elseif (false != in_array($ip, $dd)) {
                        $result = false;
                    }
                }
            }
            if (property_exists($this->config, "hosts_allowed_prod")) {
                $dd = $this->config->hosts_allowed_prod;
                if (null !== $dd) {
                    if (true == in_array("*", $dd) && $result) {
                        $result = true;
                    } elseif (true === in_array($ip, $dd) && false === $result) {
                        $result = true;
                    }
                }
            }
        }

        if (false === $result) {
            throw new Server403(new \ArrayObject(array("solution" =>
                "Add the current host to the allowed hosts list")));
        }

        return (true);
    }
private function checkHosts():bool
    {
        if (null === $this->config) {
            return (true);
        }
        $current_env = FEnv::get("framework.env");
        $ip = ToolsExceptions::getClientIp();
        $result = true;
        if ("dev" === $current_env) {
            if (property_exists($this->config, "hosts_denied_dev")) {
                $dd = $this->config->hosts_denied_dev;
                if (null !== $dd) {
                    if (false != in_array("*", $dd)) {
                        $result = false;
                    } elseif (false != in_array($ip, $dd)) {
                        $result = false;
                    }
                }
            }
            if (property_exists($this->config, "hosts_allowed_dev")) {
                $dd = $this->config->hosts_allowed_dev;
                if (null !== $dd) {
                    if (true == in_array("*", $dd) && $result) {
                        $result = true;
                    } elseif (true === in_array($ip, $dd) && false === $result) {
                        $result = true;
                    }
                }
            }
        } elseif ("prod" === $current_env) {
            if (property_exists($this->config, "hosts_denied_prod")) {
                $dd = $this->config->hosts_denied_prod;
                if (null !== $dd) {
                    if (false != in_array("*", $dd)) {
                        $result = false;
                    } elseif (false != in_array($ip, $dd)) {
                        $result = false;
                    }
                }
            }
            if (property_exists($this->config, "hosts_allowed_prod")) {
                $dd = $this->config->hosts_allowed_prod;
                if (null !== $dd) {
                    if (true == in_array("*", $dd) && $result) {
                        $result = true;
                    } elseif (true === in_array($ip, $dd) && false === $result) {
                        $result = true;
                    }
                }
            }
        }

        if (false === $result) {
            throw new Server403(new \ArrayObject(array("solution" =>
                "Add the current host to the allowed hosts list")));
        }

        return (true);
    }
private function checkHosts ( ) : bool { if ( null === $ this -> config ) { return ( true ) ; } $ current_env = FEnv :: get ( "framework.env" ) ; $ ip = ToolsExceptions :: getClientIp ( ) ; $ result = true ; if ( "dev" === $ current_env ) { if ( property_exists ( $ this -> config , "hosts_denied_dev" ) ) { $ dd = $ this -> config -> hosts_denied_dev ; if ( null !== $ dd ) { if ( false != in_array ( "*" , $ dd ) ) { $ result = false ; } elseif ( false != in_array ( $ ip , $ dd ) ) { $ result = false ; } } } if ( property_exists ( $ this -> config , "hosts_allowed_dev" ) ) { $ dd = $ this -> config -> hosts_allowed_dev ; if ( null !== $ dd ) { if ( true == in_array ( "*" , $ dd ) && $ result ) { $ result = true ; } elseif ( true === in_array ( $ ip , $ dd ) && false === $ result ) { $ result = true ; } } } } elseif ( "prod" === $ current_env ) { if ( property_exists ( $ this -> config , "hosts_denied_prod" ) ) { $ dd = $ this -> config -> hosts_denied_prod ; if ( null !== $ dd ) { if ( false != in_array ( "*" , $ dd ) ) { $ result = false ; } elseif ( false != in_array ( $ ip , $ dd ) ) { $ result = false ; } } } if ( property_exists ( $ this -> config , "hosts_allowed_prod" ) ) { $ dd = $ this -> config -> hosts_allowed_prod ; if ( null !== $ dd ) { if ( true == in_array ( "*" , $ dd ) && $ result ) { $ result = true ; } elseif ( true === in_array ( $ ip , $ dd ) && false === $ result ) { $ result = true ; } } } } if ( false === $ result ) { throw new Server403 ( new \ ArrayObject ( array ( "solution" => "Add the current host to the allowed hosts list" ) ) ) ; } return ( true ) ; }
Check the allowed and denied host for an app
@return bool True if allowed
@throws Server403 Display the message for denied host
@throws Server500 For FEnv
Check the allowed and denied host for an app