src/Jsonq.php
public function chunk($amount, callable $fn = null)
    {
        $this->prepare();

        $chunk_value = array_chunk($this->_map, $amount);
        $chunks = [];

        if (!is_null($fn) && is_callable($fn)) {
            foreach ($chunk_value as $chunk) {
                $return = $fn($chunk);
                if (!is_null($return)) {
                    $chunks[] = $return;
                }
            }
            return count($chunks) > 0 ? $chunks : null;
        }

        return $chunk_value;
    }
public function chunk($amount, callable $fn = null)
    {
        $this->prepare();

        $chunk_value = array_chunk($this->_map, $amount);
        $chunks = [];

        if (!is_null($fn) && is_callable($fn)) {
            foreach ($chunk_value as $chunk) {
                $return = $fn($chunk);
                if (!is_null($return)) {
                    $chunks[] = $return;
                }
            }
            return count($chunks) > 0 ? $chunks : null;
        }

        return $chunk_value;
    }
public function chunk ( $ amount , callable $ fn = null ) { $ this -> prepare ( ) ; $ chunk_value = array_chunk ( $ this -> _map , $ amount ) ; $ chunks = [ ] ; if ( ! is_null ( $ fn ) && is_callable ( $ fn ) ) { foreach ( $ chunk_value as $ chunk ) { $ return = $ fn ( $ chunk ) ; if ( ! is_null ( $ return ) ) { $ chunks [ ] = $ return ; } } return count ( $ chunks ) > 0 ? $ chunks : null ; } return $ chunk_value ; }
getting chunk values from prepared data

@param int $amount
@param $fn
@return object|array|bool
@throws ConditionNotAllowedException
getting chunk values from prepared data