ExtraAttributesException.php 969 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Serializer\Exception;
  11. /**
  12. * ExtraAttributesException.
  13. *
  14. * @author Julien DIDIER <julien@didier.io>
  15. */
  16. class ExtraAttributesException extends RuntimeException
  17. {
  18. private $extraAttributes;
  19. public function __construct(array $extraAttributes, \Throwable $previous = null)
  20. {
  21. $msg = sprintf('Extra attributes are not allowed ("%s" are unknown).', implode('", "', $extraAttributes));
  22. $this->extraAttributes = $extraAttributes;
  23. parent::__construct($msg, 0, $previous);
  24. }
  25. /**
  26. * Get the extra attributes that are not allowed.
  27. *
  28. * @return array
  29. */
  30. public function getExtraAttributes()
  31. {
  32. return $this->extraAttributes;
  33. }
  34. }