Error.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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\Form;
  11. /**
  12. * Wraps errors in forms
  13. *
  14. * @author Bernhard Schussek <bernhard.schussek@symfony.com>
  15. */
  16. class Error
  17. {
  18. /**
  19. * The template for the error message
  20. * @var string
  21. */
  22. protected $messageTemplate;
  23. /**
  24. * The parameters that should be substituted in the message template
  25. * @var array
  26. */
  27. protected $messageParameters;
  28. /**
  29. * Constructor
  30. *
  31. * @param string $messageTemplate The template for the error message
  32. * @param array $messageParameters The parameters that should be
  33. * substituted in the message template.
  34. */
  35. public function __construct($messageTemplate, array $messageParameters = array())
  36. {
  37. $this->messageTemplate = $messageTemplate;
  38. $this->messageParameters = $messageParameters;
  39. }
  40. /**
  41. * Returns the error message template
  42. *
  43. * @return string
  44. */
  45. public function getMessageTemplate()
  46. {
  47. return $this->messageTemplate;
  48. }
  49. /**
  50. * Returns the parameters to be inserted in the message template
  51. *
  52. * @return array
  53. */
  54. public function getMessageParameters()
  55. {
  56. return $this->messageParameters;
  57. }
  58. }