Skip to content

Commit

Permalink
Merge pull request #4 from biigle/patch-1
Browse files Browse the repository at this point in the history
Improve validation
  • Loading branch information
mzur authored Nov 28, 2024
2 parents 4b7da60 + 89217e5 commit 8a7a073
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Annotation.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ public static function validate(array $data): void
if (!array_key_exists($key, $data)) {
throw new \Exception("Missing key '$key' in Annotation");
}

if (is_null($data[$key])) {
throw new \Exception("Missing value for '$key' in Category");
}
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ public static function validate(array $data): void
if (!array_key_exists($key, $data)) {
throw new \Exception("Missing key '$key' in Category");
}

if (is_null($data[$key])) {
throw new \Exception("Missing value for '$key' in Category");
}
}
}
}
4 changes: 4 additions & 0 deletions src/Coco.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ public static function validate(array $data): void
if (!array_key_exists($key, $data)) {
throw new \Exception("Missing key '$key' in Coco");
}

if (is_null($data[$key])) {
throw new \Exception("Missing value for '$key' in Coco");
}
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ public static function validate(array $data): void
if (!array_key_exists($key, $data)) {
throw new \Exception("Missing key '$key' in Image");
}

if (is_null($data[$key])) {
throw new \Exception("Missing value for '$key' in Image");
}
}
}
}

0 comments on commit 8a7a073

Please sign in to comment.