Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Add support for the PHP language #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions python/languages/php.py
Original file line number Diff line number Diff line change
@@ -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())