REBELinBLUE\Deployer\Validators\RepositoryValidator::validate PHP Метод

validate() публичный Метод

Validate that the repository URL looks valid.
public validate ( string $attribute, string $value, array $parameters ) : boolean
$attribute string
$value string
$parameters array
Результат boolean
    public function validate($attribute, $value, $parameters)
    {
        if (preg_match('/^(ssh|git|https?):\\/\\//', $value)) {
            // Plain old git repo
            return true;
        }
        if (preg_match('/^(.*)@(.*):(.*)\\/(.*)\\.git/', $value)) {
            // Gitlab
            return true;
        }
        /*
        TODO: improve these regexs, using the following stolen from PHPCI (sorry Dan!)
        'ssh': /git\@github\.com\:([a-zA-Z0-9_\-]+\/[a-zA-Z0-9_\-]+)\.git/,
        'git': /git\:\/\/github.com\/([a-zA-Z0-9_\-]+\/[a-zA-Z0-9_\-]+)\.git/,
        'http': /https\:\/\/github\.com\/([a-zA-Z0-9_\-]+\/[a-zA-Z0-9_\-]+)(\.git)?/
        
        'ssh': /git\@bitbucket\.org\:([a-zA-Z0-9_\-]+\/[a-zA-Z0-9_\-]+)\.git/,
        'http': /https\:\/\/[a-zA-Z0-9_\-]+\@bitbucket.org\/([a-zA-Z0-9_\-]+\/[a-zA-Z0-9_\-]+)\.git/,
        'anon': /https\:\/\/bitbucket.org\/([a-zA-Z0-9_\-]+\/[a-zA-Z0-9_\-]+)(\.git)?/
        */
        return false;
    }
RepositoryValidator