public function insertToken(string $lockTo = '', bool $echo = true): string
    {
        $token_array = $this->getTokenArray($lockTo);
        $ret = \implode(
            \array_map(
                function(string $key, string $value): string {
                    return "<!--\n-->".
                        "<input type=\"hidden\"" .
                        " name=\"" . $key . "\"" .
                        " value=\"" . self::noHTML($value) . "\"" .
                        " />";
                },
                \array_keys($token_array),
                $token_array
            )
        );
        if ($echo) {
            echo $ret;
            return '';
        }
        return $ret;
    }
public function insertToken(string $lockTo = '', bool $echo = true): string
    {
        $token_array = $this->getTokenArray($lockTo);
        $ret = \implode(
            \array_map(
                function(string $key, string $value): string {
                    return "<!--\n-->".
                        "<input type=\"hidden\"" .
                        " name=\"" . $key . "\"" .
                        " value=\"" . self::noHTML($value) . "\"" .
                        " />";
                },
                \array_keys($token_array),
                $token_array
            )
        );
        if ($echo) {
            echo $ret;
            return '';
        }
        return $ret;
    }
public function insertToken ( string $ lockTo = '' , bool $ echo = true ) : string { $ token_array = $ this -> getTokenArray ( $ lockTo ) ; $ ret = \ implode ( \ array_map ( function ( string $ key , string $ value ) : string { return "<!--\n-->" . "<input type=\"hidden\"" . " name=\"" . $ key . "\"" . " value=\"" . self :: noHTML ( $ value ) . "\"" . " />" ; } , \ array_keys ( $ token_array ) , $ token_array ) ) ; if ( $ echo ) { echo $ ret ; return '' ; } return $ ret ; }
Insert a CSRF token to a form

@param string $lockTo This CSRF token is only valid for this HTTP request endpoint
@param bool $echo if true, echo instead of returning
@return string
@throws \Exception
@throws \TypeError
Insert a CSRF token to a form