<commit_before><?php

/*
 * This file is part of the Indigo Common package.
 *
 * (c) Indigo Development Team
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Indigo\Common\Controller;

use LogicException;

/**
 * Theme Controller
 *
 * @author <NAME> <<EMAIL>>
 */
trait Theme
{
	use Base
	{
		before as private __before;
	}

	/**
	 * {@inheritdoc}
	 */
	public function before()
	{
		$this->__before();

		$config = $this->request->getConfig();
		$finder = $this->app->getViewManager()->getFinder();

		$config->load('theme', true);

		$paths = $config->get('theme.paths', []);
		$theme = $config->get('theme.active', 'default');

		if ($config->get('theme.use_component_name', false))
		{
			$component = $this->request->getComponent()->getUri();
			$component = str_replace('/', DIRECTORY_SEPARATOR, trim($component, '/'));
		}

		foreach ($paths as $path)
		{
			$path .= DIRECTORY_SEPARATOR.$theme;

			if (isset($component))
			{
				$path .= DIRECTORY_SEPARATOR.$component;
			}

			$finder->addPath($path);
		}
	}<commit_msg>Some fixes<commit_after><?php

/*
 * This file is part of the Indigo Common package.
 *
 * (c) Indigo Development Team
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Indigo\Common\Controller;

use LogicException;

/**
 * Theme Controller
 *
 * @author <NAME> <<EMAIL>>
 */
trait Theme
{
	use Base
	{
		before as private __before;
	}

	/**
	 * {@inheritdoc}
	 */
	public function before()
	{
		$this->__before();

		$config = $this->request->getConfig();
		$finder = $this->app->getViewManager()->getFinder();

		$config->load('theme', true);

		$paths = $config->get('theme.paths', []);
		$theme = $config->get('theme.active', 'default');

		if ($config->get('theme.use_component', false))
		{
			$component = $this->request->getComponent()->getUri();
			$component = str_replace('/', DIRECTORY_SEPARATOR, trim($component, '/'));
		}

		foreach ($paths as $path)
		{
			rtrim($path, '\\/');
			$path .= DIRECTORY_SEPARATOR.$theme;

			if (isset($component))
			{
				$path .= DIRECTORY_SEPARATOR.$component;
			}

			is_dir($path) and $finder->addPath($path);
		}
	}
{'fraction_non_alphanumeric': 0.1791630340017437, 'fraction_numerical': 0.0, 'mean_word_length': 3.6646341463414633, 'pattern_counts': {'":': 0, '<': 11, '<?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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5867186', 'n_tokens_mistral': 831, 'n_tokens_neox': 744, 'n_words': 176}