attributes = []; } /** * @inheritdoc */ public function setAttribute($scope, $key, $enabled) { if (!\array_key_exists($scope, $this->attributes)) { $this->attributes[$scope] = []; } $this->attributes[$scope][$key] = $enabled; return $this; } /** * @inheritdoc */ public function getAttribute($scope, $key) { if (\array_key_exists($scope, $this->attributes) && \array_key_exists($key, $this->attributes[$scope])) { return $this->attributes[$scope][$key]; } return null; } /** * @inheritdoc */ public function toArray() { $result = []; foreach ($this->attributes as $scope => $keys) { foreach ($keys as $key => $enabled) { $result[] = [ "scope" => $scope, "key" => $key, "enabled" => $enabled ]; } } return $result; } }