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

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

public validate ( $source, $target )
    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;
    }

Usage Example

Пример #1
0
 private function validateWorkFlow(InputInterface $input, $source, $target)
 {
     if ($input->getOption('ignore-workflow')) {
         $this->getHelper('gush_style')->note('Ignoring merge-workflow.');
         return;
     }
     $config = array_merge(['preset' => 'semver', 'branches' => [], 'unknown_branch_policy' => MergeWorkflowValidator::BRANCH_POLICY_ALLOW], $this->getConfig()->get(['merge_workflow', 'validation'], Config::CONFIG_LOCAL, []));
     $validator = new MergeWorkflowValidator($config['preset'], $config['branches'], $config['unknown_branch_policy']);
     $validator->validate($source, $target);
 }
All Usage Examples Of Gush\Validator\MergeWorkflowValidator::validate