error_code = $error_code; // Only drop values the client cannot act on. `0` and `false` are meaningful here (e.g. a confirmed total of zero). $this->additional_data = array_filter( (array) $additional_data, static function ( $value ) { return null !== $value && '' !== $value && [] !== $value; } ); parent::__construct( $message, $http_status_code ); } /** * Returns the error code. * * @return string */ public function getErrorCode() { return $this->error_code; } /** * Returns additional error data. * * @return array */ public function getAdditionalData() { return $this->additional_data; } }