Airship\Hangar\Commands\autoRun::getType PHP Method

getType() protected method

Get information about a script
protected getType ( string $path ) : string
$path string
return string
    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');
    }