src/Entity/Collection.php
public function getArray($key, callable $callback = null)
    {
        $list = $this->get($key);
        if (!is_array($list)) {
            return [];
        }
        if (is_callable($callback)) {
            return array_map($callback, $list);
        }
        return $list;
    }
public function getArray($key, callable $callback = null)
    {
        $list = $this->get($key);
        if (!is_array($list)) {
            return [];
        }
        if (is_callable($callback)) {
            return array_map($callback, $list);
        }
        return $list;
    }
Get a list item from collection with given key.
If item does not exist an empty array is returned.

@param string        $key
@param callable|null $callback Optional callable to map items in list

@return array