private function getLength($value): int {
    if (is_array($value) || $value instanceof \Countable) return count($value);
    if ($value instanceof \Traversable) return iterator_count($value);
    if (is_string($value)) return mb_strlen($value);
    throw new \InvalidArgumentException("The specified value is not iterable: $value");
  }
private function getLength($value): int {
    if (is_array($value) || $value instanceof \Countable) return count($value);
    if ($value instanceof \Traversable) return iterator_count($value);
    if (is_string($value)) return mb_strlen($value);
    throw new \InvalidArgumentException("The specified value is not iterable: $value");
  }
Returns the length of the specified value.
@param mixed $value An iterable value, like an array or a string.
@return int The length of the specified value.
@throws \InvalidArgumentException The specified value is not iterable.