Refactor extensions.ts

This commit is contained in:
Shivam Mathur
2020-07-24 10:28:48 +05:30
parent e0561697dc
commit 0fae072f07
5 changed files with 285 additions and 355 deletions

View File

@ -259,3 +259,57 @@ export async function suppressOutput(os_version: string): Promise<string> {
);
}
}
/**
* Function to get Xdebug version compatible with php versions.
*
* @param version
*/
export async function getXdebugVersion(version: string): Promise<string> {
switch (version) {
case '5.3':
return '2.2.7';
case '5.4':
return '2.4.1';
case '5.5':
case '5.6':
return '2.5.5';
case '7.0':
return '2.7.2';
default:
return '2.9.6';
}
}
/**
* Function to get script to log unsupported extensions.
*
* @param extension
* @param version
* @param os_version
*/
export async function getUnsupportedLog(
extension: string,
version: string,
os_version: string
): Promise<string> {
return (
'\n' +
(await addLog(
'$cross',
extension,
[extension, 'is not supported on PHP', version].join(' '),
os_version
)) +
'\n'
);
}
/**
* Function to join strings with space
*
* @param str
*/
export async function joins(...str: string[]): Promise<string> {
return [...str].join(' ');
}