public static function SchemaMetatagManager::countNumericKeys in Schema.org Metatag 7
If the item is an array with numeric keys, count the keys.
Overrides SchemaMetatagManagerInterface::countNumericKeys
2 calls to SchemaMetatagManager::countNumericKeys()
- SchemaMetatagManager::isObject in src/
SchemaMetatagManager.php - Is object?
- SchemaMetatagManager::pivot in src/
SchemaMetatagManager.php - Pivot multiple value results.
File
- src/
SchemaMetatagManager.php, line 168 - A generic substitution for Drupal 8 Random utility.
Class
- SchemaMetatagManager
- Class SchemaMetatagManager.
Code
public static function countNumericKeys($item) {
if (!is_array($item)) {
return 0;
}
foreach (array_keys($item) as $key) {
if (!is_numeric($key)) {
return 0;
}
}
return count($item);
}