return $values < 0 ? mt_rand($values, 0) : mt_rand(0, $values);
}
- if (is_object($values) && $values instanceof Traversable) {
+ if ($values instanceof Traversable) {
$values = iterator_to_array($values);
} elseif (is_string($values)) {
if ('' === $values) {
*/
function twig_slice(Twig_Environment $env, $item, $start, $length = null, $preserveKeys = false)
{
- if (is_object($item) && $item instanceof Traversable) {
+ if ($item instanceof Traversable) {
$item = iterator_to_array($item, false);
}
*/
function twig_join_filter($value, $glue = '')
{
- if (is_object($value) && $value instanceof Traversable) {
+ if ($value instanceof Traversable) {
$value = iterator_to_array($value, false);
}
}
return false !== strpos($compare, (string) $value);
- } elseif (is_object($compare) && $compare instanceof Traversable) {
+ } elseif ($compare instanceof Traversable) {
return in_array($value, iterator_to_array($compare, false), is_object($value));
}
*/
function twig_array_batch($items, $size, $fill = null)
{
- if (is_object($items) && $items instanceof Traversable) {
+ if ($items instanceof Traversable) {
$items = iterator_to_array($items, false);
}