File: MacroTemplateValidator.php

package info (click to toggle)
icingaweb2-module-graphite 1.2.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,000 kB
  • sloc: php: 3,546; javascript: 88; sh: 54; makefile: 15
file content (21 lines) | stat: -rw-r--r-- 459 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?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();
        }
    }
}