transformPath($rule->getPath()); if (! $this->hasRule($pathKey)) { $this->rules[$pathKey] = []; } $this->rules[$pathKey][] = $rule; } protected function hasRule($path) { return isset($this->rules[$this->transformPath($path)]); } protected function serializePath(array $path) { return implode('->', $path); } protected function transformPath($path) { if (is_array($path)) { $path = $this->serializePath($path); } return $path; } }