Page MenuHomeDevCentral

Map payload to classes
Open, WishlistPublic

Description

We currently parse payloads through json_decode as:

  • \stdClass for most of them
  • PhabricatorStory for Phabricator ones

Plan is instead to:

  • create an abstract BasePayload class (probably empty?)
  • create classes for GitHub, DockerHub, Jenkins, etc. payloads
  • PhabricatorStory should inherit too
  • map objects deserialized with json_decode to these new classes

This will have several benefits:

  • we know everywhere an object is payload
  • we can add an explicit return type at Nasqueron\Notifications\Console\Commands\NotificationsPayload::formatPayload() (currently an @return PhabricatorStory|stdClass)

good-first-issue — This task has been especially identified as suitable to discover our code base.

We use JSON mapper to map JSON payloads to classes.