Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function __construct()
 {
     parent::__construct();
     $this->settings = new BaseUrlSettings($this, $this->config);
 }
/**
 * Provides logging capabilities.
 *
 * @param \Drupal\security_review\Check $check
 *   The Check the event is related to.
 * @param string $message
 *   The message.
 * @param array $context
 *   The context of the message.
 * @param int $level
 *   Severity (RfcLogLevel).
 */
function hook_security_review_log(Check $check, $message, array $context, $level)
{
    if ($check->getNamespace() == "My Module") {
        // Do something with the information.
    }
}
Exemplo n.º 3
0
 /**
  * @return string
  *   The result message for this result.
  */
 public function resultMessage()
 {
     return $this->check->getMessage($this->result);
 }
Exemplo n.º 4
0
 /**
  * Helper function for sorting checks.
  *
  * @param \Drupal\security_review\Check $a
  *   Check A.
  * @param \Drupal\security_review\Check $b
  *   Check B.
  *
  * @return int
  *   The comparison's result.
  */
 public static function compareChecks(Check $a, Check $b)
 {
     // If one comes from security_review and the other doesn't, prefer the one
     // with the security_review namespace.
     if ($a->getMachineNamespace() == 'security_review' && $b->getMachineNamespace() != 'security_review') {
         return -1;
     } elseif ($a->getMachineNamespace() != 'security_review' && $b->getMachineNamespace() == 'security_review') {
         return 1;
     } else {
         if ($a->getNamespace() == $b->getNamespace()) {
             // If the namespaces match, sort by title.
             return strcmp($a->getTitle(), $b->getTitle());
         } else {
             // If the namespaces don't mach, sort by namespace.
             return strcmp($a->getNamespace(), $b->getNamespace());
         }
     }
 }