mirror of
https://github.com/YGGverse/net-php.git
synced 2025-02-05 11:24:16 +00:00
allow mixed data type values for IS methods
This commit is contained in:
parent
3a89da61d5
commit
8eba81ae5f
14
src/Dig.php
14
src/Dig.php
@ -16,19 +16,21 @@ class Dig
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function isHostName(string $hostname): bool
|
public static function isHostName(mixed $value): bool
|
||||||
{
|
{
|
||||||
return false !== filter_var($hostname, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME);
|
return is_string($value) && false !== filter_var($value, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function isRecord(string $record): bool
|
public static function isRecord(mixed $value): bool
|
||||||
{
|
{
|
||||||
return isset(self::_records()[$record]);
|
return is_string($value) && isset(self::_records()[$value]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function isRecordValue(string $record, string $value): bool
|
public static function isRecordValue(mixed $record, mixed $value): bool
|
||||||
{
|
{
|
||||||
return isset(self::_records()[$record]) && self::_records()[$record]($value);
|
return is_string($record) &&
|
||||||
|
is_string($value) &&
|
||||||
|
isset(self::_records()[$record]) && self::_records()[$record]($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function records(string $hostname, array $records, array &$result = [], array &$error = []): array
|
public static function records(string $hostname, array $records, array &$result = [], array &$error = []): array
|
||||||
|
Loading…
x
Reference in New Issue
Block a user