mirror of
https://github.com/Icinga/icingaweb2-module-graphite.git
synced 2026-03-15 23:22:43 -04:00
21 lines
459 B
PHP
21 lines
459 B
PHP
<?php
|
|
|
|
namespace Icinga\Module\Graphite\Web\Form\Validator;
|
|
|
|
use Icinga\Module\Graphite\Util\MacroTemplate;
|
|
use InvalidArgumentException;
|
|
|
|
/**
|
|
* Validates Icinga-style macro templates
|
|
*/
|
|
class MacroTemplateValidator extends CustomErrorMessagesValidator
|
|
{
|
|
protected function validate($value)
|
|
{
|
|
try {
|
|
new MacroTemplate($value);
|
|
} catch (InvalidArgumentException $e) {
|
|
return $e->getMessage();
|
|
}
|
|
}
|
|
}
|