Skip to content

Commit e4bc4e8

Browse files
committed
fix: only include categories if provided
1 parent a4e710c commit e4bc4e8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Responses/Moderations/CreateResponseResult.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ public static function from(array $attributes): self
2727
$categories = [];
2828

2929
foreach (Category::cases() as $category) {
30+
if (! isset($attributes['category_scores'][$category->value])) {
31+
continue;
32+
}
33+
3034
$categories[$category->value] = CreateResponseCategory::from([
3135
'category' => $category->value,
3236
'violated' => $attributes['categories'][$category->value],

0 commit comments

Comments
 (0)