<commit_before><?php namespace Sprockets;

use SplFileInfo;
use Sprockets\Exception\AssetNotFoundException;

class Finder {
	protected $loadPaths;

	protected $typeExtensions = array(
		'stylesheet' => '.css',
		'javascript' => '.js'
	);

	public function __construct($loadPaths)
	{
		$this->loadPaths = $loadPaths;
	}

	public function find($name, $type = null)
	{
		if ($type && !with(new SplFileInfo($name))->getExtension())
		{
			$name.= $this->typeExtensions[$type];
		}

		foreach ($this->loadPaths as $loadPath)
		{
			$path = $loadPath . "/$name*";

			$files = glob($path);

			if (count($files) > 0)<commit_msg>Fix the finder more accurate when requesting a file without adding an extension<commit_after><?php namespace Sprockets;

use SplFileInfo;
use Sprockets\Exception\AssetNotFoundException;

class Finder {
	protected $loadPaths;

	protected $typeExtensions = array(
		'stylesheet' => '.css',
		'javascript' => '.js'
	);

	public function __construct($loadPaths)
	{
		$this->loadPaths = $loadPaths;
	}

	public function find($name, $type = null)
	{
		if ($type && !with(new SplFileInfo($name))->getExtension())
		{
			$name.= $this->typeExtensions[$type];
		}

		foreach ($this->loadPaths as $loadPath)
		{
			$path = $loadPath . (with(new SplFileInfo($name))->getExtension() ? "/$name*" : "/$name.*");

			$files = glob($path);

			if (count($files) > 0)
{'fraction_non_alphanumeric': 0.16982507288629736, 'fraction_numerical': 0.0014577259475218659, 'mean_word_length': 4.342412451361867, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 18, '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': '323712', 'n_tokens_mistral': 510, 'n_tokens_neox': 459, 'n_words': 106}