<commit_before><?php
namespace WordpressLib\Theme;

class Assets {

	protected $baseUri;
	protected $baseDir;
	protected $assetPath;
	protected $prefix;

	public function __construct($prefix, $baseUri, $baseDir, $assetPath) {
		$this->prefix = $prefix;
		$this->baseUri = $baseUri;
		$this->baseDir = $baseDir;
		$this->assetPath = $assetPath;
	}

	public function asset($path, $callback, $ext='', $folder='', $deps=[], $version='') {
		call_user_func(
			$callback,
			$this->prefix.'_'.basename($path),
			"$this->baseUri/$this->assetPath/$folder/$path.$ext",
			$deps,
			empty($version) ? filemtime("$this->baseDir/$this->assetPath/$folder/$path.$ext") : $version
		);
	}

	public function raw($type, $handle, $path, $deps=[], $version='') {
		call_user_func(
			$type == 'js' ? 'wp_enqueue_script' : 'wp_enqueue_style',
			$handle,
			"$this->baseUri/$this->assetPath/$path",
			$deps,
			empty($version) ? filemtime("$this->baseDir/$this->assetPath/$path") : $version
		);
	}

	public function js($path, $deps=[], $version='') {
		$this->asset($path, 'wp_enqueue_script', 'js', 'js', $deps, $version);
	}

	public function css($path, $deps=[], $version='') {
		$this->asset($path, 'wp_enqueue_style', 'css', 'css', $deps, $version);
	}

	public function dir($path, $type) {
		$base = "$this->baseDir/$this->assetPath/$type";
		foreach (glob("$base/$path/*.$type") as $file) {
			call_user_func([$this, $type], "$path/" . basename($file, ".$type"));
		}
	}

}<commit_msg>Asset dependencies on directory enqueue<commit_after><?php
namespace WordpressLib\Theme;

class Assets {

	protected $baseUri;
	protected $baseDir;
	protected $assetPath;
	protected $prefix;

	public function __construct($prefix, $baseUri, $baseDir, $assetPath) {
		$this->prefix = $prefix;
		$this->baseUri = $baseUri;
		$this->baseDir = $baseDir;
		$this->assetPath = $assetPath;
	}

	public function asset($path, $callback, $ext='', $folder='', $deps=[], $version='') {
		call_user_func(
			$callback,
			$this->prefix.'_'.basename($path),
			"$this->baseUri/$this->assetPath/$folder/$path.$ext",
			$deps,
			empty($version) ? filemtime("$this->baseDir/$this->assetPath/$folder/$path.$ext") : $version
		);
	}

	public function raw($type, $handle, $path, $deps=[], $version='') {
		call_user_func(
			$type == 'js' ? 'wp_enqueue_script' : 'wp_enqueue_style',
			$handle,
			"$this->baseUri/$this->assetPath/$path",
			$deps,
			empty($version) ? filemtime("$this->baseDir/$this->assetPath/$path") : $version
		);
	}

	public function js($path, $deps=[], $version='') {
		$this->asset($path, 'wp_enqueue_script', 'js', 'js', $deps, $version);
	}

	public function css($path, $deps=[], $version='') {
		$this->asset($path, 'wp_enqueue_style', 'css', 'css', $deps, $version);
	}

	public function dir($path, $type, $deps=[]) {
		$base = "$this->baseDir/$this->assetPath/$type";
		foreach (glob("$base/$path/*.$type") as $file) {
			call_user_func([$this, $type], "$path/" . basename($file, ".$type"), $deps);
		}
	}

}
{'fraction_non_alphanumeric': 0.22537562604340566, 'fraction_numerical': 0.0, 'mean_word_length': 4.863013698630137, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 37, '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': '312622', 'n_tokens_mistral': 1189, 'n_tokens_neox': 1105, 'n_words': 202}