public function updateActivity(string $env):Renderer
    {
        $allowed     = $this->get("request")->get("allowed");
        $denied     = $this->get("request")->get("denied");

        if (!in_array($env, array("dev", "prod"))) {
            throw new Server500(new \ArrayObject(array("explain" => "Undefined environment $env", "solution" =>
                "Environment must be [dev or prod]")));
        }

        if (trim($allowed) == "" || trim($denied) == "") {
            return ((new Renderer())->jsonRenderer(array("code" => 500, "msg" => "Error on hosts parameters")));
        }


        $allowed = (object)(explode(";", $allowed));
        $denied = (object)(explode(";", $denied));

        $a = new \stdClass();
        $a->allowed = $allowed;
        $a->denied = $denied;

        JL::put(
            FEnv::get("framework.config").'hosts/hosts.'.$env.'.json',
            json_encode($a, JSON_PRETTY_PRINT)
        );

        return ((new Renderer())->jsonRenderer(array("code" => 200, "msg" => "OK")));
    }
public function updateActivity(string $env):Renderer
    {
        $allowed     = $this->get("request")->get("allowed");
        $denied     = $this->get("request")->get("denied");

        if (!in_array($env, array("dev", "prod"))) {
            throw new Server500(new \ArrayObject(array("explain" => "Undefined environment $env", "solution" =>
                "Environment must be [dev or prod]")));
        }

        if (trim($allowed) == "" || trim($denied) == "") {
            return ((new Renderer())->jsonRenderer(array("code" => 500, "msg" => "Error on hosts parameters")));
        }


        $allowed = (object)(explode(";", $allowed));
        $denied = (object)(explode(";", $denied));

        $a = new \stdClass();
        $a->allowed = $allowed;
        $a->denied = $denied;

        JL::put(
            FEnv::get("framework.config").'hosts/hosts.'.$env.'.json',
            json_encode($a, JSON_PRETTY_PRINT)
        );

        return ((new Renderer())->jsonRenderer(array("code" => 200, "msg" => "OK")));
    }
public function updateActivity ( string $ env ) : Renderer { $ allowed = $ this -> get ( "request" ) -> get ( "allowed" ) ; $ denied = $ this -> get ( "request" ) -> get ( "denied" ) ; if ( ! in_array ( $ env , array ( "dev" , "prod" ) ) ) { throw new Server500 ( new \ ArrayObject ( array ( "explain" => "Undefined environment $env" , "solution" => "Environment must be [dev or prod]" ) ) ) ; } if ( trim ( $ allowed ) == "" || trim ( $ denied ) == "" ) { return ( ( new Renderer ( ) ) -> jsonRenderer ( array ( "code" => 500 , "msg" => "Error on hosts parameters" ) ) ) ; } $ allowed = ( object ) ( explode ( ";" , $ allowed ) ) ; $ denied = ( object ) ( explode ( ";" , $ denied ) ) ; $ a = new \ stdClass ( ) ; $ a -> allowed = $ allowed ; $ a -> denied = $ denied ; JL :: put ( FEnv :: get ( "framework.config" ) . 'hosts/hosts.' . $ env . '.json' , json_encode ( $ a , JSON_PRETTY_PRINT ) ) ; return ( ( new Renderer ( ) ) -> jsonRenderer ( array ( "code" => 200 , "msg" => "OK" ) ) ) ; }
save one hosts configuration
@param string $env Environment name
@return Renderer
@throws
save one hosts configuration