public static function createFromProfile($name, $weight = 0, $definition = [])
  {
    $policyDefinition = new static();
    $policyDefinition->setName($name)
                     ->setWeight($weight);

    if (isset($definition['parameters'])) {
      $policyDefinition->setParameters($definition['parameters']);
    }

    // Load a policy to get defaults.
    $policy = Policy::load($name);

    if (isset($definition['severity'])) {
      $policyDefinition->setSeverity($definition['severity']);
    }
    else {
      $policyDefinition->setSeverity($policy->getSeverity());
    }

    // Track policies that are depended on.
    // foreach ((array) $policy->get('depends') as $name) {
    //   $policyDefinition->setDependencyPolicyName($name);
    // }

    return $policyDefinition;
  }
public static function createFromProfile($name, $weight = 0, $definition = [])
  {
    $policyDefinition = new static();
    $policyDefinition->setName($name)
                     ->setWeight($weight);

    if (isset($definition['parameters'])) {
      $policyDefinition->setParameters($definition['parameters']);
    }

    // Load a policy to get defaults.
    $policy = Policy::load($name);

    if (isset($definition['severity'])) {
      $policyDefinition->setSeverity($definition['severity']);
    }
    else {
      $policyDefinition->setSeverity($policy->getSeverity());
    }

    // Track policies that are depended on.
    // foreach ((array) $policy->get('depends') as $name) {
    //   $policyDefinition->setDependencyPolicyName($name);
    // }

    return $policyDefinition;
  }
public static function createFromProfile ( $ name , $ weight = 0 , $ definition = [ ] ) { $ policyDefinition = new static ( ) ; $ policyDefinition -> setName ( $ name ) -> setWeight ( $ weight ) ; if ( isset ( $ definition [ 'parameters' ] ) ) { $ policyDefinition -> setParameters ( $ definition [ 'parameters' ] ) ; } // Load a policy to get defaults. $ policy = Policy :: load ( $ name ) ; if ( isset ( $ definition [ 'severity' ] ) ) { $ policyDefinition -> setSeverity ( $ definition [ 'severity' ] ) ; } else { $ policyDefinition -> setSeverity ( $ policy -> getSeverity ( ) ) ; } // Track policies that are depended on. // foreach ((array) $policy->get('depends') as $name) { //   $policyDefinition->setDependencyPolicyName($name); // } return $ policyDefinition ; }
Build a PolicyDefinition from Profile input.

@var $name string
@var $definition array
Build a PolicyDefinition from Profile input .