private function getCoverageCount(string $id, array $covered) : int
    {
        $id              = str_replace('\/', '/', $id);
        [$u, $c, $d, $p] = explode('::', $id);

        $u = preg_quote(mb_substr($u, 1), '/');
        $c = preg_quote(mb_substr($c, 1), '/');
        $p = preg_quote(mb_substr($p, 1), '/');
        $d = preg_quote(mb_substr($d, 1), '/');

        $count = 0;

        if (0 === mb_strlen($p)) {
            $p = '.*?';
        }
        if (0 === mb_strlen($d)) {
            $d = '.*?';
        }

        $regex = sprintf('/^u%d::c%d::d%s::p%s$/', $u, $c, $d, $p);

        foreach ($covered as $patternId) {
            if (preg_match($regex, $patternId)) {
                ++$count;
            }
        }

        return $count;
    }