HEX
Server: LiteSpeed
System: Linux node612.namehero.net 4.18.0-553.121.1.lve.el8.x86_64 #1 SMP Thu Apr 30 16:40:41 UTC 2026 x86_64
User: dfwparty (1186)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: /home/dfwparty/www/wp-content/mu-plugins/wp-toolkit/Waf/Extensions/ActiveRulesVulnerabilityMap.php
<?php
// Copyright 1999-2026. WebPros International GmbH. All rights reserved.

namespace Webpros\WptkWpPlugin\WpToolkit\Waf\Extensions;

class ActiveRulesVulnerabilityMap
{
    /**
     * @var array<int, string>
     */
    private $convertedMap;

    /**
     * @param $activeRules array<string, {
     *                     id: int,
     *                     rules: array,
     *                     }
     */
    public function __construct(array $activeRules = [])
    {
        $this->convertedMap = $this->convertMap($activeRules);
    }

    /**
     * @param int $ruleId
     *
     * @return string|null
     */
    public function getVulnerabilityId($ruleId)
    {
        if (isset($this->convertedMap[$ruleId])) {
            return $this->convertedMap[$ruleId];
        }

        return null;
    }

    /**
     * @param $activeRules array<string, {
     *                     id: int,
     *                     rules: array,
     *                     }
     *
     * @return array<int, string>
     */
    private function convertMap(array $activeRules)
    {
        $map = [];

        foreach ($activeRules as $vulnerabilityId => $rule) {
            $map[$rule['id']] = $vulnerabilityId;
        }

        return $map;
    }
}