public static function Inline::isHash in Lockr 7.3
Check if given array is hash or just normal indexed array.
@internal
Parameters
array|\ArrayObject|\stdClass $value The PHP array or array-like object to check:
Return value
bool true if value is hash array, false otherwise
3 calls to Inline::isHash()
- Dumper::dump in vendor/
symfony/ yaml/ Dumper.php - Dumps a PHP value to YAML.
- Inline::dumpArray in vendor/
symfony/ yaml/ Inline.php - Dumps a PHP array to a YAML string.
- InlineTest::testIsHash in vendor/
symfony/ yaml/ Tests/ InlineTest.php - @dataProvider getDataForIsHash
File
- vendor/
symfony/ yaml/ Inline.php, line 259
Class
- Inline
- Inline implements a YAML parser/dumper for the YAML inline syntax.
Namespace
Symfony\Component\YamlCode
public static function isHash($value) {
if ($value instanceof \stdClass || $value instanceof \ArrayObject) {
return true;
}
$expectedKey = 0;
foreach ($value as $key => $val) {
if ($key !== $expectedKey++) {
return true;
}
}
return false;
}