public function createActivity():Renderer
    {
        $name = $this->clean($this->get("request")->get("name"));
        $status = $this->get("request")->get("status");
        $namespace = $this->get("request")->get("namespace");

        if ($name == "") {
            return ((new Renderer())->jsonRenderer(array("code" => 500,
                "msg" => "Service name is empty : $namespace")));
        }

        if ($status == "" || !in_array($status, array("enabled", "disabled"))) {
            return ((new Renderer())->jsonRenderer(array("code" => 500, "msg" => "Undefined status : $status")));
        }

        if ($namespace == "") {
            return ((new Renderer())->jsonRenderer(array("code" => 500, "msg" => "Undefined namespace : $namespace")));
        }


        $fcore = json_decode(file_get_contents(FEnv::get("framework.config.core.services.file")));
        foreach ($fcore as $one) {
            if ($one == $name) {
                return ((new Renderer())->jsonRenderer(array("code" => 500, "msg" => "Service already exist")));
            }
        }

        $fcore->$name = new \stdClass();
        $fcore->$name->namespace = $namespace;
        $fcore->$name->status = $status;
        $fcore = json_encode($fcore, JSON_PRETTY_PRINT);
        file_put_contents(FEnv::get("framework.config.core.services.file"), $fcore);

        return ((new Renderer())->jsonRenderer(array("code" => 200, "msg" => "OK")));
    }
public function createActivity():Renderer
    {
        $name = $this->clean($this->get("request")->get("name"));
        $status = $this->get("request")->get("status");
        $namespace = $this->get("request")->get("namespace");

        if ($name == "") {
            return ((new Renderer())->jsonRenderer(array("code" => 500,
                "msg" => "Service name is empty : $namespace")));
        }

        if ($status == "" || !in_array($status, array("enabled", "disabled"))) {
            return ((new Renderer())->jsonRenderer(array("code" => 500, "msg" => "Undefined status : $status")));
        }

        if ($namespace == "") {
            return ((new Renderer())->jsonRenderer(array("code" => 500, "msg" => "Undefined namespace : $namespace")));
        }


        $fcore = json_decode(file_get_contents(FEnv::get("framework.config.core.services.file")));
        foreach ($fcore as $one) {
            if ($one == $name) {
                return ((new Renderer())->jsonRenderer(array("code" => 500, "msg" => "Service already exist")));
            }
        }

        $fcore->$name = new \stdClass();
        $fcore->$name->namespace = $namespace;
        $fcore->$name->status = $status;
        $fcore = json_encode($fcore, JSON_PRETTY_PRINT);
        file_put_contents(FEnv::get("framework.config.core.services.file"), $fcore);

        return ((new Renderer())->jsonRenderer(array("code" => 200, "msg" => "OK")));
    }
public function createActivity ( ) : Renderer { $ name = $ this -> clean ( $ this -> get ( "request" ) -> get ( "name" ) ) ; $ status = $ this -> get ( "request" ) -> get ( "status" ) ; $ namespace = $ this -> get ( "request" ) -> get ( "namespace" ) ; if ( $ name == "" ) { return ( ( new Renderer ( ) ) -> jsonRenderer ( array ( "code" => 500 , "msg" => "Service name is empty : $namespace" ) ) ) ; } if ( $ status == "" || ! in_array ( $ status , array ( "enabled" , "disabled" ) ) ) { return ( ( new Renderer ( ) ) -> jsonRenderer ( array ( "code" => 500 , "msg" => "Undefined status : $status" ) ) ) ; } if ( $ namespace == "" ) { return ( ( new Renderer ( ) ) -> jsonRenderer ( array ( "code" => 500 , "msg" => "Undefined namespace : $namespace" ) ) ) ; } $ fcore = json_decode ( file_get_contents ( FEnv :: get ( "framework.config.core.services.file" ) ) ) ; foreach ( $ fcore as $ one ) { if ( $ one == $ name ) { return ( ( new Renderer ( ) ) -> jsonRenderer ( array ( "code" => 500 , "msg" => "Service already exist" ) ) ) ; } } $ fcore -> $ name = new \ stdClass ( ) ; $ fcore -> $ name -> namespace = $ namespace ; $ fcore -> $ name -> status = $ status ; $ fcore = json_encode ( $ fcore , JSON_PRETTY_PRINT ) ; file_put_contents ( FEnv :: get ( "framework.config.core.services.file" ) , $ fcore ) ; return ( ( new Renderer ( ) ) -> jsonRenderer ( array ( "code" => 200 , "msg" => "OK" ) ) ) ; }
Create one service
@return Renderer JSON render
@throws \Exception
Create one service