summaryrefslogtreecommitdiffstats
path: root/library/Director/Data/InvalidDataException.php
blob: 9abaf7c3a28f165a69a0c6a3d8df786615f20564 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php

namespace Icinga\Module\Director\Data;

use InvalidArgumentException;

class InvalidDataException extends InvalidArgumentException
{
    /**
     * @param string $expected
     * @param mixed $value
     */
    public function __construct($expected, $value)
    {
        parent::__construct("$expected expected, got " . static::getPhpType($value));
    }

    public static function getPhpType($var)
    {
        if (is_object($var)) {
            return get_class($var);
        }

        return gettype($var);
    }
}