'_']); $notEmpty = static fn(string $v) => trim($v) !== ''; $array = array_filter($array, $notEmpty); foreach ($array as $key => $value) { $key = $slugify->slugify($key); if (property_exists(__CLASS__, $key)) { $this->{$key} = trim($value); } } } public static function fill(array $data): Metadata { return new self($data); } public static function empty(): Metadata { return new self([]); } public function toArray(): array { return get_object_vars($this); } }