Update AnnotationsBag.php

refactor the class and added the JsonSerializable interface