private function detectParametersType(string $parameters, string $keyword_ft):array
    {
        if ($keyword_ft != "parameters") {
            return (array());
        }
        $parameters = str_replace("parameters:", "", $parameters);
        if (!(isset($parameters[0]) && $parameters[0] == "{")) {
            throw new Server500(new \ArrayObject(array("explain" => "Delimiter '{' is missing for parameters keyword",
                "solution" => "Please check Mercure file")));
        }
        if (!(isset($parameters[strlen($parameters) - 1 ]) && $parameters[strlen($parameters) - 1] == "}")) {
            throw new Server500(new \ArrayObject(array("explain" => "Delimiter '}' is missing for parameters keyword",
                "solution" => "Please check Mercure file")));
        }

        $parameters = str_replace("{", "", $parameters);
        $parameters = str_replace("}", "", $parameters);
        $e = explode(',', $parameters);

        $param = $this->splitParameters($e);
        if (count($param) == 0) {
            throw new Server500(new \ArrayObject(array("explain" => "Unknow error on parameters in Mercure file",
                "solution" => "Please check Mercure file")));
        }
        return ($param);
    }
private function detectParametersType(string $parameters, string $keyword_ft):array
    {
        if ($keyword_ft != "parameters") {
            return (array());
        }
        $parameters = str_replace("parameters:", "", $parameters);
        if (!(isset($parameters[0]) && $parameters[0] == "{")) {
            throw new Server500(new \ArrayObject(array("explain" => "Delimiter '{' is missing for parameters keyword",
                "solution" => "Please check Mercure file")));
        }
        if (!(isset($parameters[strlen($parameters) - 1 ]) && $parameters[strlen($parameters) - 1] == "}")) {
            throw new Server500(new \ArrayObject(array("explain" => "Delimiter '}' is missing for parameters keyword",
                "solution" => "Please check Mercure file")));
        }

        $parameters = str_replace("{", "", $parameters);
        $parameters = str_replace("}", "", $parameters);
        $e = explode(',', $parameters);

        $param = $this->splitParameters($e);
        if (count($param) == 0) {
            throw new Server500(new \ArrayObject(array("explain" => "Unknow error on parameters in Mercure file",
                "solution" => "Please check Mercure file")));
        }
        return ($param);
    }
private function detectParametersType ( string $ parameters , string $ keyword_ft ) : array { if ( $ keyword_ft != "parameters" ) { return ( array ( ) ) ; } $ parameters = str_replace ( "parameters:" , "" , $ parameters ) ; if ( ! ( isset ( $ parameters [ 0 ] ) && $ parameters [ 0 ] == "{" ) ) { throw new Server500 ( new \ ArrayObject ( array ( "explain" => "Delimiter '{' is missing for parameters keyword" , "solution" => "Please check Mercure file" ) ) ) ; } if ( ! ( isset ( $ parameters [ strlen ( $ parameters ) - 1 ] ) && $ parameters [ strlen ( $ parameters ) - 1 ] == "}" ) ) { throw new Server500 ( new \ ArrayObject ( array ( "explain" => "Delimiter '}' is missing for parameters keyword" , "solution" => "Please check Mercure file" ) ) ) ; } $ parameters = str_replace ( "{" , "" , $ parameters ) ; $ parameters = str_replace ( "}" , "" , $ parameters ) ; $ e = explode ( ',' , $ parameters ) ; $ param = $ this -> splitParameters ( $ e ) ; if ( count ( $ param ) == 0 ) { throw new Server500 ( new \ ArrayObject ( array ( "explain" => "Unknow error on parameters in Mercure file" , "solution" => "Please check Mercure file" ) ) ) ; } return ( $ param ) ; }
Detect parameters type for a specific route
@param string $parameters Line this parameters contains
@param string $keyword_ft keyword for instruction : Check if parameters
@return array Return the parameters formatted
@throws Server500 If a delimiter is missing
Detect parameters type for a specific route