MetadataMergeException.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. /**
  3. * @section LICENSE
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along
  15. * with this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  17. * http://www.gnu.org/copyleft/gpl.html
  18. *
  19. * @file
  20. * @ingroup Session
  21. */
  22. namespace MediaWiki\Session;
  23. use Exception;
  24. use UnexpectedValueException;
  25. /**
  26. * Subclass of UnexpectedValueException that can be annotated with additional
  27. * data for debug logging.
  28. *
  29. * @copyright © 2016 Wikimedia Foundation and contributors
  30. * @since 1.27
  31. */
  32. class MetadataMergeException extends UnexpectedValueException {
  33. /** @var array $context */
  34. protected $context;
  35. /**
  36. * @param string $message
  37. * @param int $code
  38. * @param Exception|null $previous
  39. * @param array $context Additional context data
  40. */
  41. public function __construct(
  42. $message = '',
  43. $code = 0,
  44. Exception $previous = null,
  45. array $context = []
  46. ) {
  47. parent::__construct( $message, $code, $previous );
  48. $this->context = $context;
  49. }
  50. /**
  51. * Get context data.
  52. * @return array
  53. */
  54. public function getContext() {
  55. return $this->context;
  56. }
  57. /**
  58. * Set context data.
  59. * @param array $context
  60. */
  61. public function setContext( array $context ) {
  62. $this->context = $context;
  63. }
  64. }