src/Refinery.php
public function refine($raw, $retainKey = false)
    {
        if ((is_array($raw) && $this->isMultidimensional($raw)) || $raw instanceof Traversable) {
            return $this->refineCollection($raw, $retainKey);
        }

        return $this->refineItem($raw);
    }
public function refine($raw, $retainKey = false)
    {
        if ((is_array($raw) && $this->isMultidimensional($raw)) || $raw instanceof Traversable) {
            return $this->refineCollection($raw, $retainKey);
        }

        return $this->refineItem($raw);
    }
Refine the item(s) using the set template.

@param  mixed $raw
@param bool   $retainKey
@return mixed