Gush\Validator\MergeWorkflowValidator::__construct PHP Method

__construct() public method

public __construct ( $preset, array $branches = [], $unknownBranchPolicy = self::BRANCH_POLICY_ALLOW )
$branches array
    public function __construct($preset, array $branches = [], $unknownBranchPolicy = self::BRANCH_POLICY_ALLOW)
    {
        if (!in_array($preset, [self::PRESET_SEMVER, self::PRESET_GIT_FLOW, self::PRESET_NONE], true)) {
            throw new \InvalidArgumentException(['Merge workflow preset is not valid.', 'Supported workflow presets are: semver, git-flow or none.']);
        }
        if (!in_array($unknownBranchPolicy, [self::BRANCH_POLICY_ALLOW, self::BRANCH_POLICY_DENY], true)) {
            throw new \InvalidArgumentException(['Merge workflow-policy is not valid.', 'Supported workflow policies are: allow-merge or deny-merge.']);
        }
        if (self::BRANCH_POLICY_DENY === $unknownBranchPolicy && 0 === count($branches)) {
            throw new \InvalidArgumentException('Merge workflow-policy is set to "deny-merge" but no branches are configured.');
        }
        $this->preset = $preset;
        $this->branches = $branches;
        $this->policy = $unknownBranchPolicy;
    }