protected function getReferenceValidator($values)
    {
        return function ($val) use ($values) {
            $type = $values['type'];

            $validators = array(
                'hg' => array(
                    'regex' => '/^(https?):\/\//',
                    'message' => Lang::get('error_mercurial')
                ),
                'remote' => array(
                    'regex' => '/^(git|https?):\/\//',
                    'message' => Lang::get('error_remote')
                ),
                'gitlab' => array(
                    'regex' => '`^(.*)@(.*):(.*)/(.*)\.git`',
                    'message' => Lang::get('error_gitlab')
                ),
                'github' => array(
                    'regex' => '/^[a-zA-Z0-9_\-]+\/[a-zA-Z0-9_\-\.]+$/',
                    'message' => Lang::get('error_github')
                ),
                'bitbucket' => array(
                    'regex' => '/^[a-zA-Z0-9_\-]+\/[a-zA-Z0-9_\-\.]+$/',
                    'message' => Lang::get('error_bitbucket')
                ),
            );

            if (in_array($type, $validators) && !preg_match($validators[$type]['regex'], $val)) {
                throw new \Exception($validators[$type]['message']);
            } elseif ($type == 'local' && !is_dir($val)) {
                throw new \Exception(Lang::get('error_path'));
            }

            return true;
        };
    }
protected function getReferenceValidator($values)
    {
        return function ($val) use ($values) {
            $type = $values['type'];

            $validators = array(
                'hg' => array(
                    'regex' => '/^(https?):\/\//',
                    'message' => Lang::get('error_mercurial')
                ),
                'remote' => array(
                    'regex' => '/^(git|https?):\/\//',
                    'message' => Lang::get('error_remote')
                ),
                'gitlab' => array(
                    'regex' => '`^(.*)@(.*):(.*)/(.*)\.git`',
                    'message' => Lang::get('error_gitlab')
                ),
                'github' => array(
                    'regex' => '/^[a-zA-Z0-9_\-]+\/[a-zA-Z0-9_\-\.]+$/',
                    'message' => Lang::get('error_github')
                ),
                'bitbucket' => array(
                    'regex' => '/^[a-zA-Z0-9_\-]+\/[a-zA-Z0-9_\-\.]+$/',
                    'message' => Lang::get('error_bitbucket')
                ),
            );

            if (in_array($type, $validators) && !preg_match($validators[$type]['regex'], $val)) {
                throw new \Exception($validators[$type]['message']);
            } elseif ($type == 'local' && !is_dir($val)) {
                throw new \Exception(Lang::get('error_path'));
            }

            return true;
        };
    }
protected function getReferenceValidator ( $ values ) { return function ( $ val ) use ( $ values ) { $ type = $ values [ 'type' ] ; $ validators = array ( 'hg' => array ( 'regex' => '/^(https?):\/\//' , 'message' => Lang :: get ( 'error_mercurial' ) ) , 'remote' => array ( 'regex' => '/^(git|https?):\/\//' , 'message' => Lang :: get ( 'error_remote' ) ) , 'gitlab' => array ( 'regex' => '`^(.*)@(.*):(.*)/(.*)\.git`' , 'message' => Lang :: get ( 'error_gitlab' ) ) , 'github' => array ( 'regex' => '/^[a-zA-Z0-9_\-]+\/[a-zA-Z0-9_\-\.]+$/' , 'message' => Lang :: get ( 'error_github' ) ) , 'bitbucket' => array ( 'regex' => '/^[a-zA-Z0-9_\-]+\/[a-zA-Z0-9_\-\.]+$/' , 'message' => Lang :: get ( 'error_bitbucket' ) ) , ) ; if ( in_array ( $ type , $ validators ) && ! preg_match ( $ validators [ $ type ] [ 'regex' ] , $ val ) ) { throw new \ Exception ( $ validators [ $ type ] [ 'message' ] ) ; } elseif ( $ type == 'local' && ! is_dir ( $ val ) ) { throw new \ Exception ( Lang :: get ( 'error_path' ) ) ; } return true ; } ; }
Get the validator to use to check project references.
@param $values
@return callable
Get the validator to use to check project references .