diff options
Diffstat (limited to 'matrix-specification/Data/PushRule.php')
| -rw-r--r-- | matrix-specification/Data/PushRule.php | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/matrix-specification/Data/PushRule.php b/matrix-specification/Data/PushRule.php new file mode 100644 index 0000000..2217a78 --- /dev/null +++ b/matrix-specification/Data/PushRule.php @@ -0,0 +1,32 @@ +<?php + +namespace Matrix\Data; + +class PushRule implements \JsonSerializable +{ + /** + * @param array<string|array> $actions + * @param PushCondition[] $conditions + */ + public function __construct( + private array $actions, + private bool $default, + private bool $enabled, + private string $ruleId, + private ?array $conditions = null, + private ?string $pattern = null, + ) + {} + + public function jsonSerialize(): array + { + return [ + "actions" => $this->actions, + "conditions" => $this->conditions, + "default" => $this->default, + "enabled" => $this->enabled, + "pattern" => $this->pattern, + "rule_id" => $this->ruleId, + ]; + } +} |
