icingaweb2-module-director/library/Director/Data/InvalidDataException.php

27 lines
530 B
PHP
Raw Normal View History

2021-08-03 11:45:13 +02:00
<?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);
}
}