<commit_before><?php
/**
 * @version     $Id$
 * @package     Nooku_Components
 * @subpackage  Files
 * @copyright   Copyright (C) 2011 - 2012 Timble CVBA and Contributors. (http://www.timble.net).
 * @license     GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link        http://www.nooku.org
 */

/**
 * Files Model Class
 *
 * @author      <NAME> <http://nooku.assembla.com/profile/ercanozkaya>
 * @package     Nooku_Components
 * @subpackage  Files
 */

class ComFilesModelFiles extends ComFilesModelNodes
{
    public function getList()
    {
        if (!isset($this->_list))
        {
            $state = $this->_state;

            $files = $state->container->getAdapter('iterator')->getFiles(array(
        		'path'    => $this->_getPath(),
        		'exclude' => array('.svn', '.htaccess', '.git', 'CVS', 'index.html', '.DS_Store', 'Thumbs.db', 'Desktop.ini'),
        		'filter'  => array($this, 'iteratorFilter'),
        		'map'     => array($this, 'iteratorMap'),
                'sort'    => $state->sort
        	));
        	if ($files === false) {
        		throw new KModelException('Invalid folder');
        	}

            $this->_total = count($files);
            
            if (strtolower($this->_state->direction) == 'desc') {
            	$files = array_reverse($files);
            }
            
            $files = array_slice($files, $state->offset, $state->limit ? $state->limit : $this->_total);

            $data = array();
            foreach ($files as $file)
            {
                $data[] = array(
                	'container' => $state->container,
                	'folder' => $state->folder,
                	'name' => $file
                );
            }

            $this->_list = $this->getRowset(array(
                'data' => $data
            ));
        }

        return parent::getList();
    }

	public function iteratorMap($path)
	{
		return basename($path);
	}

	public function iteratorFilter($path)
	{
		$filename = basename($path);
		$extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION));

		if ($this->_state->name) {
			if (!in_array($filename, (array) $this->_state->name)) {
				return false;
			}
		}<commit_msg>KModel::getList() had been renamed to KModel::getRowset()<commit_after><?php
/**
 * @version     $Id$
 * @package     Nooku_Components
 * @subpackage  Files
 * @copyright   Copyright (C) 2011 - 2012 Timble CVBA and Contributors. (http://www.timble.net).
 * @license     GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link        http://www.nooku.org
 */

/**
 * Files Model Class
 *
 * @author      <NAME> <http://nooku.assembla.com/profile/ercanozkaya>
 * @package     Nooku_Components
 * @subpackage  Files
 */

class ComFilesModelFiles extends ComFilesModelNodes
{
    public function getRowset()
    {
        if (!isset($this->_rowset))
        {
            $state = $this->_state;

            $files = $state->container->getAdapter('iterator')->getFiles(array(
        		'path'    => $this->_getPath(),
        		'exclude' => array('.svn', '.htaccess', '.git', 'CVS', 'index.html', '.DS_Store', 'Thumbs.db', 'Desktop.ini'),
        		'filter'  => array($this, 'iteratorFilter'),
        		'map'     => array($this, 'iteratorMap'),
                'sort'    => $state->sort
        	));

        	if ($files === false) {
        		throw new UnexpectedValueException('Invalid folder');
        	}

            $this->_total = count($files);
            
            if (strtolower($this->_state->direction) == 'desc') {
            	$files = array_reverse($files);
            }
            
            $files = array_slice($files, $state->offset, $state->limit ? $state->limit : $this->_total);

            $data = array();
            foreach ($files as $file)
            {
                $data[] = array(
                	'container' => $state->container,
                	'folder' => $state->folder,
                	'name' => $file
                );
            }

            $this->_rowset = $this->getRowset(array(
                'data' => $data
            ));
        }

        return parent::getRowset();
    }

	public function iteratorMap($path)
	{
		return basename($path);
	}

	public function iteratorFilter($path)
	{
		$filename = basename($path);
		$extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION));

		if ($this->_state->name) {
			if (!in_array($filename, (array) $this->_state->name)) {
				return false;
			}
		}
{'fraction_non_alphanumeric': 0.1667411712114439, 'fraction_numerical': 0.004023245417970496, 'mean_word_length': 1.9616148246194574, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 71, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, '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': '4329418', 'n_tokens_mistral': 1421, 'n_tokens_neox': 1350, 'n_words': 257}