protected function getType(string $path) : string
{
if (\preg_match('#/(.+?)\\.([^\\.]+)$#', $path, $matches)) {
$t = \strtolower($matches[2]);
switch ($t) {
case 'php':
case 'php3':
case 'phtml':
case 'inc':
return 'php';
case 'mysql':
return 'mysql';
case 'pgsql':
return 'pgsql';
case 'sh':
return 'sh';
default:
throw new \Error('Unknown script type: ' . $t);
}
}
throw new \Error('Unknown script type');
}