public function addCollection(RuleCollection $collection)
    {
        // we need to remove all rules with the same names first because just replacing them
        // would not place the new rule at the end of the merged array
        foreach ($collection->all() as $name => $rule) {
            unset($this->rules[$name]);
            $this->rules[$name] = $rule;
        }

        $this->resources = array_merge($this->resources, $collection->getResources());
    }