From 5dda71baa6c45ac7bf5147d02489536d414cb2fc Mon Sep 17 00:00:00 2001 From: alerighi Date: Tue, 21 May 2019 23:53:03 +0200 Subject: [PATCH] Add support to the PHP language --- python/languages/php.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 python/languages/php.py diff --git a/python/languages/php.py b/python/languages/php.py new file mode 100644 index 0000000..807ee9f --- /dev/null +++ b/python/languages/php.py @@ -0,0 +1,27 @@ +from typing import List + +from task_maker.languages import Language, LanguageManager, CommandType + + +class LanguagePHP(Language): + @property + def name(self): + return "PHP" + + @property + def source_extensions(self): + return [".php"] + + def get_execution_command(self, exe_name: str, args: List[str], + main=None) -> (CommandType, List[str]): + """ + Get the command to use to execute a file from this language + :param exe_name: Name of the (maybe compiled) executable + :param args: Argument to pass to the executable + :param main: Name of the main file, useful for Java + """ + return CommandType.LOCAL_FILE, ["php", exe_name] + args + + +def register(): + LanguageManager.register_language(LanguagePHP())