<commit_before><?php
/******************************************************************************
 * An iterator interface over the Leagues flysystem.
 * Copyright (c) 2014, 2015 <NAME> <<EMAIL>>
 *
 * This software is licensed under The MIT License. You should have received 
 * a copy of the along with the code.
 */

namespace Lechimp\Flightcontrol;

/**
* This object can perform a recursion on the files in a directory.
* I don't know if the name really fits.
*/
abstract class DirectoryRecursor {
    use NamedFilterTrait;

    /**
     * Get a recursor that folds all files in this recursor that match the
     * provided predicate.
     *
     * @param  \Closure             $predicate  (FSObject -> Bool)
     * @return DirectoryRecursor
     */
    public function filter(\Closure $predicate) {
        return new FilterDirectoryRecursor($predicate, $this);
    }

    /**
     * Finally collaps the files fitting this recursor. 
     *
     * Give an initial value of a type $start_t and a function from $start_t and
     * File to another $start_t. Will then recursively feed any file below the
     * directory and the successive $start_t values to the function.
     *
     * @param $start_t      $init
     * @param \Closure      $collapse   ($start_t, File) -> $start_t
     * @return $start_t
     */
    abstract public function with($init, \Closure $collapse);
}
<commit_msg>some better docu on foldFiles()->with(..)<commit_after><?php
/******************************************************************************
 * An iterator interface over the Leagues flysystem.
 * Copyright (c) 2014, 2015 <NAME> <<EMAIL>>
 *
 * This software is licensed under The MIT License. You should have received 
 * a copy of the along with the code.
 */

namespace Lechimp\Flightcontrol;

/**
* This object can perform a recursion on the files in a directory.
* I don't know if the name really fits.
*/
abstract class DirectoryRecursor {
    use NamedFilterTrait;

    /**
     * Get a recursor that folds all files in this recursor that match the
     * provided predicate.
     *
     * @param  \Closure             $predicate  (FSObject -> Bool)
     * @return DirectoryRecursor
     */
    public function filter(\Closure $predicate) {
        return new FilterDirectoryRecursor($predicate, $this);
    }

    /**
     * Finally collaps the files fitting this recursor. 
     *
     * Give an initial value of a any type and a function from that type and
     * File to another value of the type. Will then recursively feed any file 
     * below the directory and the successive values to the function.
     *
     * Returns the value that is retreived from the function after the last
     * File was given to it.
     *
     * @example
     *
     * \\ Collect all file names in a directory:
     * $init = array();     \\ Start with an empty array
     * $function = function($array, $file) { 
     *      $array[] = $file->name();
     *      return $array();
     * };
     *      
     * $result = $directory->foldFiles()->with($init, $function);
     * // $result will be the names of all files in $directory and the directories
     * // below it.
     *
     * @param mixed         $init
     * @param \Closure      $collapse   (mixed, File) -> mixed 
     * @return mixed 
     */
    abstract public function with($init, \Closure $collapse);
}

{'fraction_non_alphanumeric': 0.13610698365527488, 'fraction_numerical': 0.00475482912332838, 'mean_word_length': 2.611587982832618, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '5363860', 'n_tokens_mistral': 945, 'n_tokens_neox': 885, 'n_words': 364}