<commit_before><?php
namespace Codesleeve\AssetPipeline;

class AssetCacheRepository
{
	private $env;
	private $cache;
	private $config;
	private $asset;

	/**
	 * [__construct description]
	 * @param  {[type]} $env
	 * @param  {[type]} $cache
	 * @param  {[type]} $config
	 * @param  {[type]} $input
	 * @return {[type]}
	 */
	public function __construct($env, $cache, $config, $asset)
	{
		$this->env = $env;
		$this->cache = $cache;
		$this->config = $config;
		$this->asset = $asset;
	}

	/**
	 * [javascripts description]
	 * @param  {[type]} $path
	 * @return {[type]}
	 */
	public function javascripts($path)
	{
		if ($this->env == "production" && $this->cache->get('asset_pipeline_recently_scanned_javascripts')) {
			return $this->fetch($path, 'javascripts');
		}

		// scan the asset directories
		//$lastUpdatedAt = $this->asset->lastUpdatedAt($path);

		// // if a file has been changed then lets forget our cache
		// if ($this->cache->get('asset_pipeline_last_updated_at') != $lastUpdatedAt) {
		// 	$this->cache->forever('asset_pipeline_last_updated_at', $lastUpdatedAt);
		// 	$manager[$path] = 
		// }

		return $this->fetch($path, 'javascripts');
	}

	/**
	 * [stylesheets description]
	 * @param  {[type]} $path
	 * @return {[type]}
	 */
	public function stylesheets($path)
	{
		if ($this->env == "production" && $this->cache->get('asset_pipeline_recently_scanned_stylesheets')) {
			return $this->fetch($path, 'stylesheets');
		}

		return $this->fetch($path, 'stylesheets');
	}

	/**
	 * [fetch description]
	 * @param  {[type]} $path
	 * @param  {[type]} $type
	 * @return {[type]}
	 */
	public function fetch($path, $type)
	{
		$manager = $this->manager();

		if (array_key_exists($path, $manager)) {
			return $manager[$path];
		}

		if ($type == 'javascripts') {
			$manager[$path] = $this->asset->javascripts($path);

		}
		if ($type == 'stylesheets') {
			$manager[$path] = $this->asset->stylesheets($path);
		}

		$this->manager($manager);
	}

	/**
	 * [manager description]
	 * @return {[type]}
	 */
	public function manager($manager = null)
	{
 		if (!$this->cache->has('asset_pipeline_manager')) {
			$manager = array();
		}

		if (!is_null($manager)) {
			$this->cache->forever('asset_pipeline_manager', $manager);
		}

		return $this->cache->get('asset_pipeline_manager');
	}

}
<commit_msg>putting private vars at bottom of class<commit_after><?php
namespace Codesleeve\AssetPipeline;

class AssetCacheRepository
{
	/**
	 * [__construct description]
	 * @param  {[type]} $env
	 * @param  {[type]} $cache
	 * @param  {[type]} $config
	 * @param  {[type]} $input
	 * @return {[type]}
	 */
	public function __construct($env, $cache, $config, $asset)
	{
		$this->env = $env;
		$this->cache = $cache;
		$this->config = $config;
		$this->asset = $asset;
	}

	/**
	 * [javascripts description]
	 * @param  {[type]} $path
	 * @return {[type]}
	 */
	public function javascripts($path)
	{
		if ($this->env == "production" && $this->cache->get('asset_pipeline_recently_scanned_javascripts')) {
			return $this->fetch($path, 'javascripts');
		}

		// scan the asset directories
		//$lastUpdatedAt = $this->asset->lastUpdatedAt($path);

		// // if a file has been changed then lets forget our cache
		// if ($this->cache->get('asset_pipeline_last_updated_at') != $lastUpdatedAt) {
		// 	$this->cache->forever('asset_pipeline_last_updated_at', $lastUpdatedAt);
		// 	$manager[$path] = 
		// }

		return $this->fetch($path, 'javascripts');
	}

	/**
	 * [stylesheets description]
	 * @param  {[type]} $path
	 * @return {[type]}
	 */
	public function stylesheets($path)
	{
		if ($this->env == "production" && $this->cache->get('asset_pipeline_recently_scanned_stylesheets')) {
			return $this->fetch($path, 'stylesheets');
		}

		return $this->fetch($path, 'stylesheets');
	}

	/**
	 * [fetch description]
	 * @param  {[type]} $path
	 * @param  {[type]} $type
	 * @return {[type]}
	 */
	public function fetch($path, $type)
	{
		$manager = $this->manager();

		if (array_key_exists($path, $manager)) {
			return $manager[$path];
		}

		if ($type == 'javascripts') {
			$manager[$path] = $this->asset->javascripts($path);

		}
		if ($type == 'stylesheets') {
			$manager[$path] = $this->asset->stylesheets($path);
		}

		$this->manager($manager);
	}

	/**
	 * [manager description]
	 * @return {[type]}
	 */
	public function manager($manager = null)
	{
 		if (!$this->cache->has('asset_pipeline_manager')) {
			$manager = array();
		}

		if (!is_null($manager)) {
			$this->cache->forever('asset_pipeline_manager', $manager);
		}

		return $this->cache->get('asset_pipeline_manager');
	}

	private $env;
	private $cache;
	private $config;
	private $asset;
}

{'fraction_non_alphanumeric': 0.20072758399315216, 'fraction_numerical': 0.0, 'mean_word_length': 3.8789144050104385, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 67, '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': '2364197', 'n_tokens_mistral': 1789, 'n_tokens_neox': 1598, 'n_words': 318}