<commit_before><?php

namespace FuelPHP\FileSystem;

use Closure;

class Finder
{
	/**
	 * @var  string  $defaultExtension  default extension
	 */
	protected $defaultExtension = 'php';

	/**
	 * @var  array  $paths  paths to look in
	 */
	protected $paths = array();

	/**
	 * Constructor.
	 *
	 * @param  array  $path  paths
	 */
	public function __construct($paths = array())
	{
		$this->addPaths((array) $paths);
	}

	/**
	 * Adds paths to look in.
	 *
	 * @param   array  $paths  paths
	 * @return  $this
	 */
	public function addPaths(array $paths)
	{
		array_map(array($this, 'addPath'), $paths);

		return $this;
	}

	/**
	 * Add a path
	 *
	 * @param   string  $path  path
	 * @return  $this
	 */
	public function addPath($path)
	{
		$path = $this->normalizePath($path);

		// This is done for easy reference and
		// eliminates the need to check for doubles
		$this->paths[$path] = $path;

		return $this;
	}

	/**
	 * Get all the paths
	 *
	 * @return   array  paths
	 */
	public function getPaths()
	{
		return $this->paths;
	}

	/**
	 * Replace all the paths
	 *
	 * @param   array  $paths  paths
	 * @return  $this
	 */
	public function setPaths(array $paths)
	{
		$this->paths = array();
		$this->addPaths($paths);

		return $this;
	}

	/**
	 * Remove paths to look in
	 *
	 * @param   array  $paths  paths to remove
	 * @return  $this
	 */
	public function removePaths(array $paths)
	{
		array_map(array($this, 'removePath'), $paths);

		return $this;
	}

	/**
	 * Remove a path
	 *
	 * @param   string  $path  path
	 * @return  $this
	 */
	public function removePath($path)
	{
		$path = $this->normalizePath($path);

		if (isset($this->paths[$path]))
		{
			unset($this->paths[$path]);
		}

		return $this;
	}

	/**
	 * Normalize a path
	 *
	 * @param   string  $path  path
	 * @return  string  normalized path
	 */
	public function normalizePath($path)
	{
		$seperators = array('\\', '/./', '//');
		$path = str_replace($seperators, '/', $path);

		return rtrim($path, '/').'/';
	}

	/**
	 * Get the paths set up to look in.
	 *
	 * @return  array  paths array
	 */
	public function getPaths()
	{
		return array_values($this->paths);
	}

	/**<commit_msg>Removed duplicate function<commit_after><?php

namespace FuelPHP\FileSystem;

use Closure;

class Finder
{
	/**
	 * @var  string  $defaultExtension  default extension
	 */
	protected $defaultExtension = 'php';

	/**
	 * @var  array  $paths  paths to look in
	 */
	protected $paths = array();

	/**
	 * Constructor.
	 *
	 * @param  array  $path  paths
	 */
	public function __construct($paths = array())
	{
		$this->addPaths((array) $paths);
	}

	/**
	 * Adds paths to look in.
	 *
	 * @param   array  $paths  paths
	 * @return  $this
	 */
	public function addPaths(array $paths)
	{
		array_map(array($this, 'addPath'), $paths);

		return $this;
	}

	/**
	 * Add a path
	 *
	 * @param   string  $path  path
	 * @return  $this
	 */
	public function addPath($path)
	{
		$path = $this->normalizePath($path);

		// This is done for easy reference and
		// eliminates the need to check for doubles
		$this->paths[$path] = $path;

		return $this;
	}

	/**
	 * Remove paths to look in
	 *
	 * @param   array  $paths  paths to remove
	 * @return  $this
	 */
	public function removePaths(array $paths)
	{
		array_map(array($this, 'removePath'), $paths);

		return $this;
	}

	/**
	 * Remove a path
	 *
	 * @param   string  $path  path
	 * @return  $this
	 */
	public function removePath($path)
	{
		$path = $this->normalizePath($path);

		if (isset($this->paths[$path]))
		{
			unset($this->paths[$path]);
		}

		return $this;
	}

	/**
	 * Normalize a path
	 *
	 * @param   string  $path  path
	 * @return  string  normalized path
	 */
	public function normalizePath($path)
	{
		$seperators = array('\\', '/./', '//');
		$path = str_replace($seperators, '/', $path);

		return rtrim($path, '/').'/';
	}

	/**
	 * Get the paths set up to look in.
	 *
	 * @return  array  paths array
	 */
	public function getPaths()
	{
		return array_values($this->paths);
	}

	/**
	 * Replace all the paths
	 *
	 * @param   array  $paths  paths
	 * @return  $this
	 */
	public function setPaths(array $paths)
	{
		$this->paths = array();
		$this->addPaths($paths);

		return $this;
	}

	/**
{'fraction_non_alphanumeric': 0.1627302786962683, 'fraction_numerical': 0.0, 'mean_word_length': 2.6922406277244986, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 22, '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': '1344665', 'n_tokens_mistral': 1636, 'n_tokens_neox': 1451, 'n_words': 386}