src/Components/AbstractArray.php
protected function convertToArray($data, Closure $callback)
    {
        if (is_null($data)) {
            return array();
        }

        if ($data instanceof Traversable) {
            return iterator_to_array($data);
        }

        if (self::isStringable($data)) {
            $data = (string) $data;
            $data = trim($data);
            $data = $callback($data);
        }

        if (! is_array($data)) {
            throw new RuntimeException('Your submitted data could not be converted into a proper array');
        }

        return $data;
    }
protected function convertToArray($data, Closure $callback)
    {
        if (is_null($data)) {
            return array();
        }

        if ($data instanceof Traversable) {
            return iterator_to_array($data);
        }

        if (self::isStringable($data)) {
            $data = (string) $data;
            $data = trim($data);
            $data = $callback($data);
        }

        if (! is_array($data)) {
            throw new RuntimeException('Your submitted data could not be converted into a proper array');
        }

        return $data;
    }
protected function convertToArray ( $ data , Closure $ callback ) { if ( is_null ( $ data ) ) { return array ( ) ; } if ( $ data instanceof Traversable ) { return iterator_to_array ( $ data ) ; } if ( self :: isStringable ( $ data ) ) { $ data = ( string ) $ data ; $ data = trim ( $ data ) ; $ data = $ callback ( $ data ) ; } if ( ! is_array ( $ data ) ) { throw new RuntimeException ( 'Your submitted data could not be converted into a proper array' ) ; } return $ data ; }
convert a given data into an array

@param mixed    $data     the data to insert
@param \Closure $callback a callable function to be called to parse
a given string into the corresponding component

@return array

@throws \RuntimeException if the data is not valid
convert a given data into an array