public function validate($source, $target)
{
$validateBranches = count($this->branches) > 1;
if (self::PRESET_NONE !== $this->preset) {
$preset = 'preset' . StringUtil::concatWords($this->preset);
// When the policy is deny-merge for unknown branches
// the preset is used as primary, if it grants access then branches are not checked,
// else you would need configure branches for all checks!
if (true === $this->{$preset}($source, $target)) {
$validateBranches = self::BRANCH_POLICY_DENY === $this->policy ? false : $validateBranches;
}
}
if ($validateBranches) {
$this->validateBranches($source, $target, $this->branches, $this->policy);
}
return true;
}