Gush\Validator\MergeWorkflowValidator::validateBranches PHP Метод

validateBranches() приватный Метод

private validateBranches ( $source, $target, array $branches, $policy )
$branches array
    private function validateBranches($source, $target, array $branches, $policy)
    {
        if (array_key_exists($source, $branches)) {
            $acceptedBranch = (array) $branches[$source];
            if (!in_array($target, $acceptedBranch, true)) {
                throw new MergeWorkflowException([sprintf('Workflow violation: Cannot merge "%s" into "%s".', $source, $target), sprintf('Branches: Only branches "%s" are allowed to be merged into "%s".', implode('", "', $acceptedBranch), $target)]);
            }
            return;
            // allow merge
        }
        if (self::BRANCH_POLICY_DENY === $policy) {
            throw new MergeWorkflowException([sprintf('Workflow violation: Cannot merge "%s" into "%s".', $source, $target), sprintf('No branch constraint is set for source "%s" and policy denies merging unknown branches.', $source)]);
        }
    }