summaryrefslogtreecommitdiffstats
path: root/library/Director/Data/PropertiesFilter/ArrayCustomVariablesFilter.php
blob: ef9f2d4af88cb2f86fa173ea8262124bf54dcb42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php

namespace Icinga\Module\Director\Data\PropertiesFilter;

class ArrayCustomVariablesFilter extends CustomVariablesFilter
{
    public function match($type, $name, $object = null)
    {
        return parent::match($type, $name, $object)
        && $object !== null
        && isset($object->datatype)
        && (
            preg_match('/DataTypeArray[\w]*$/', $object->datatype)
            || (
                preg_match('/DataTypeDatalist$/', $object->datatype)
                && $object->format === 'json'
            )
        );
    }
}