public function run()
  {
    $response = new AuditResponse($this->getPolicy());
    $watchdog = Container::getLogger();

    $watchdog->info('Auditing ' . $this->getPolicy()->get('name'));
    try {
      // Ensure policy dependencies are met.
      foreach ($this->getPolicy()->getDepends() as $dependency) {
        // Throws DependencyException if dependency is not met.
        $dependency->execute($this);
      }

      // Run the audit over the policy.
      $outcome = $this->getAuditor()->execute($this);

      // Log the parameters output.
      $watchdog->debug("Tokens:\n" . Yaml::dump($this->getParameterTokens(), 4));

      // Set the response.
      $response->set($outcome, $this->getParameterTokens());
    }
    catch (\Drutiny\Policy\DependencyException $e) {
      $this->setParameter('exception', $e->getMessage());
      $response->set($e->getDependency()->getFailBehaviour(), $this->getParameterTokens());
    }
    catch (\Drutiny\AuditValidationException $e) {
      $this->setParameter('exception', $e->getMessage());
      $watchdog->warning($e->getMessage());
      $response->set(Audit::NOT_APPLICABLE, $this->getParameterTokens());
    }
    catch (\Exception $e) {
      $message = $e->getMessage();
      if (Container::getVerbosity() > OutputInterface::VERBOSITY_NORMAL) {
        $message .= PHP_EOL . $e->getTraceAsString();
      }
      $this->setParameter('exception', $message);
      $response->set(Audit::ERROR, $this->getParameterTokens());
    }

    // Omit irrelevant AuditResponses.
    if (!$response->isIrrelevant()) {
      $this->getAssessment()->setPolicyResult($response);
    }
    return $response;
  }
public function run()
  {
    $response = new AuditResponse($this->getPolicy());
    $watchdog = Container::getLogger();

    $watchdog->info('Auditing ' . $this->getPolicy()->get('name'));
    try {
      // Ensure policy dependencies are met.
      foreach ($this->getPolicy()->getDepends() as $dependency) {
        // Throws DependencyException if dependency is not met.
        $dependency->execute($this);
      }

      // Run the audit over the policy.
      $outcome = $this->getAuditor()->execute($this);

      // Log the parameters output.
      $watchdog->debug("Tokens:\n" . Yaml::dump($this->getParameterTokens(), 4));

      // Set the response.
      $response->set($outcome, $this->getParameterTokens());
    }
    catch (\Drutiny\Policy\DependencyException $e) {
      $this->setParameter('exception', $e->getMessage());
      $response->set($e->getDependency()->getFailBehaviour(), $this->getParameterTokens());
    }
    catch (\Drutiny\AuditValidationException $e) {
      $this->setParameter('exception', $e->getMessage());
      $watchdog->warning($e->getMessage());
      $response->set(Audit::NOT_APPLICABLE, $this->getParameterTokens());
    }
    catch (\Exception $e) {
      $message = $e->getMessage();
      if (Container::getVerbosity() > OutputInterface::VERBOSITY_NORMAL) {
        $message .= PHP_EOL . $e->getTraceAsString();
      }
      $this->setParameter('exception', $message);
      $response->set(Audit::ERROR, $this->getParameterTokens());
    }

    // Omit irrelevant AuditResponses.
    if (!$response->isIrrelevant()) {
      $this->getAssessment()->setPolicyResult($response);
    }
    return $response;
  }
public function run ( ) { $ response = new AuditResponse ( $ this -> getPolicy ( ) ) ; $ watchdog = Container :: getLogger ( ) ; $ watchdog -> info ( 'Auditing ' . $ this -> getPolicy ( ) -> get ( 'name' ) ) ; try { // Ensure policy dependencies are met. foreach ( $ this -> getPolicy ( ) -> getDepends ( ) as $ dependency ) { // Throws DependencyException if dependency is not met. $ dependency -> execute ( $ this ) ; } // Run the audit over the policy. $ outcome = $ this -> getAuditor ( ) -> execute ( $ this ) ; // Log the parameters output. $ watchdog -> debug ( "Tokens:\n" . Yaml :: dump ( $ this -> getParameterTokens ( ) , 4 ) ) ; // Set the response. $ response -> set ( $ outcome , $ this -> getParameterTokens ( ) ) ; } catch ( \ Drutiny \ Policy \ DependencyException $ e ) { $ this -> setParameter ( 'exception' , $ e -> getMessage ( ) ) ; $ response -> set ( $ e -> getDependency ( ) -> getFailBehaviour ( ) , $ this -> getParameterTokens ( ) ) ; } catch ( \ Drutiny \ AuditValidationException $ e ) { $ this -> setParameter ( 'exception' , $ e -> getMessage ( ) ) ; $ watchdog -> warning ( $ e -> getMessage ( ) ) ; $ response -> set ( Audit :: NOT_APPLICABLE , $ this -> getParameterTokens ( ) ) ; } catch ( \ Exception $ e ) { $ message = $ e -> getMessage ( ) ; if ( Container :: getVerbosity ( ) > OutputInterface :: VERBOSITY_NORMAL ) { $ message .= PHP_EOL . $ e -> getTraceAsString ( ) ; } $ this -> setParameter ( 'exception' , $ message ) ; $ response -> set ( Audit :: ERROR , $ this -> getParameterTokens ( ) ) ; } // Omit irrelevant AuditResponses. if ( ! $ response -> isIrrelevant ( ) ) { $ this -> getAssessment ( ) -> setPolicyResult ( $ response ) ; } return $ response ; }
Run the check and capture the outcomes.
Run the check and capture the outcomes .