added template for user defined class File

- a constructor which takes a human readable name and the file
      and internally stores the contents of the file
    - if the file does not exist, then file_get_contents function
      returns false, in that case the contents of the file is an empty
      string
This commit is contained in:
Shruti Roy
2024-03-17 23:49:48 +05:30
parent dc2bb203fe
commit d253f62f01

View File

@ -58,6 +58,29 @@ curl_setopt(\$request, {{method}}, 1);
curl_close(\$request);
var_dump(\$response);
""";
String kFileClassString = """
class File
{
public string \$name;
public string \$filename;
public string \$content;
function __construct(\$name, \$filename)
{
\$this->name = \$name;
\$this->filename = \$filename;
\$available_content = file_get_contents(\$this->filename);
\$this->content = \$available_content ? \$available_content : "";
}
}
""";
}
""";