private function excludeIrrelevantRules(&$rules)
    {
        if (!empty($rules->rules)) {
            foreach ($rules->rules as $key => $limit) {
                if (
                    isset($limit->scope)
                    && CacheRepository::SCOPE_UTM_SOURCE === intval($limit->scope)
                    && strlen(trim($limit->value))
                    && trim($limit->value) !== $this->utmSource
                ) {
                    // This is a UTM Source limit, and we do not match it, so it is currently irrelevant to us.
                    unset($rules->rules[$key]);
                    continue;
                }
                if (
                    isset($limit->scope)
                    && CacheRepository::SCOPE_CATEGORY === intval($limit->scope)
                    && $limit->value
                    && $limit->value != $this->contactSource->getCategory()
                ) {
                    // This is a Category limit, and we do not match it, so it is currently irrelevant to us.
                    unset($rules->rules[$key]);
                    continue;
                }
            }
        }
    }
private function excludeIrrelevantRules(&$rules)
    {
        if (!empty($rules->rules)) {
            foreach ($rules->rules as $key => $limit) {
                if (
                    isset($limit->scope)
                    && CacheRepository::SCOPE_UTM_SOURCE === intval($limit->scope)
                    && strlen(trim($limit->value))
                    && trim($limit->value) !== $this->utmSource
                ) {
                    // This is a UTM Source limit, and we do not match it, so it is currently irrelevant to us.
                    unset($rules->rules[$key]);
                    continue;
                }
                if (
                    isset($limit->scope)
                    && CacheRepository::SCOPE_CATEGORY === intval($limit->scope)
                    && $limit->value
                    && $limit->value != $this->contactSource->getCategory()
                ) {
                    // This is a Category limit, and we do not match it, so it is currently irrelevant to us.
                    unset($rules->rules[$key]);
                    continue;
                }
            }
        }
    }
private function excludeIrrelevantRules ( & $ rules ) { if ( ! empty ( $ rules -> rules ) ) { foreach ( $ rules -> rules as $ key => $ limit ) { if ( isset ( $ limit -> scope ) && CacheRepository :: SCOPE_UTM_SOURCE === intval ( $ limit -> scope ) && strlen ( trim ( $ limit -> value ) ) && trim ( $ limit -> value ) !== $ this -> utmSource ) { // This is a UTM Source limit, and we do not match it, so it is currently irrelevant to us. unset ( $ rules -> rules [ $ key ] ) ; continue ; } if ( isset ( $ limit -> scope ) && CacheRepository :: SCOPE_CATEGORY === intval ( $ limit -> scope ) && $ limit -> value && $ limit -> value != $ this -> contactSource -> getCategory ( ) ) { // This is a Category limit, and we do not match it, so it is currently irrelevant to us. unset ( $ rules -> rules [ $ key ] ) ; continue ; } } } }
Exclude limits that are not currently applicable, because of a tighter scope.

@param $rules

@throws \Exception
Exclude limits that are not currently applicable because of a tighter scope .