summaryrefslogtreecommitdiffstats
path: root/library/Director/PropertyModifier/PropertyModifierFromLatin1.php
blob: 272956c738f90ee265f42c41f7b26d90f4487c64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php

namespace Icinga\Module\Director\PropertyModifier;

use Icinga\Module\Director\Hook\PropertyModifierHook;
use function iconv;

class PropertyModifierFromLatin1 extends PropertyModifierHook
{
    public function getName()
    {
        return 'Convert a latin1 string to utf8';
    }

    public function transform($value)
    {
        if ($value === null) {
            return null;
        }

        return iconv('ISO-8859-15', 'UTF-8', $value);
    }
}