<commit_before><?php
/*
 * Limb PHP Framework
 *
 * @link http://limb-project.com
 * @copyright  Copyright &copy; 2004-2007 BIT(http://bit-creative.com)
 * @license    LGPL http://www.gnu.org/copyleft/lesser.html
 */
lmb_require('limb/core/src/lmbCollectionInterface.interface.php');
lmb_require('limb/core/src/lmbArrayHelper.class.php');
lmb_require('limb/core/src/lmbSet.class.php');

/**
 * class lmbCollection.
 *
 * @package core
 * @version $Id$
 */
class lmbCollection implements lmbCollectionInterface
{
  protected $dataset;
  protected $iteratedDataset;
  protected $offset = 0;
  protected $limit = 0;
  protected $current;
  protected $valid = false;

  function __construct($array = array())
  {
    $this->dataset = $array;
  }

  static function concat()
  {
    $args = func_get_args();
    $result = array();
    foreach($args as $col)
    {
      foreach($col as $value)
        $result[] = $value;
    }
    return new lmbCollection($result);
  }

  function getArray()
  {
    $result = array();
    foreach($this as $object)
      $result[] = $object;
    return $result;
  }

  static function toFlatArray($iterator, $key_field = '')
  {
    $result = array();
    foreach($iterator as $record)
    {
      $data = null;
      if(is_object($record) && method_exists($record, 'export'))
        $data = $record->export();
      else<commit_msg>[svn r6687] -- lmbCollection :: toFlatArray() third argument added what tells if we need to call export() for each record or not. The default value is true to keep BC<commit_after><?php
/*
 * Limb PHP Framework
 *
 * @link http://limb-project.com
 * @copyright  Copyright &copy; 2004-2007 BIT(http://bit-creative.com)
 * @license    LGPL http://www.gnu.org/copyleft/lesser.html
 */
lmb_require('limb/core/src/lmbCollectionInterface.interface.php');
lmb_require('limb/core/src/lmbArrayHelper.class.php');
lmb_require('limb/core/src/lmbSet.class.php');

/**
 * class lmbCollection.
 *
 * @package core
 * @version $Id$
 */
class lmbCollection implements lmbCollectionInterface
{
  protected $dataset;
  protected $iteratedDataset;
  protected $offset = 0;
  protected $limit = 0;
  protected $current;
  protected $valid = false;

  function __construct($array = array())
  {
    $this->dataset = $array;
  }

  static function concat()
  {
    $args = func_get_args();
    $result = array();
    foreach($args as $col)
    {
      foreach($col as $value)
        $result[] = $value;
    }
    return new lmbCollection($result);
  }

  function getArray()
  {
    $result = array();
    foreach($this as $object)
      $result[] = $object;
    return $result;
  }

  static function toFlatArray($iterator, $key_field = '', $export_each = true)
  {
    $result = array();
    foreach($iterator as $record)
    {
      $data = null;
      if(is_object($record) && method_exists($record, 'export') && $export_each)
        $data = $record->export();
      else
{'fraction_non_alphanumeric': 0.15102739726027398, 'fraction_numerical': 0.00821917808219178, 'mean_word_length': 3.2829912023460412, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '350900', 'n_tokens_mistral': 982, 'n_tokens_neox': 952, 'n_words': 215}