<commit_before><?php
namespace Mouf\Mvc\Splash;

/**
 * This class is in charge of all tasks that generate files:
 *  - .htaccess generation
 *  - controllers generation
 *  ...
 *  
 * @author david
 * @Component
 */
class SplashGenerateService {
	/**
	 * Writes the .htaccess file
	 * 
	 * @param string $rootUri
	 * @param array<string> $exludeExtentions
	 * @param array<string> $exludeFolders
	 */
	public function writeHtAccess($rootUri, $exludeExtentions, $exludeFolders) {

		$modelsDirName = dirname(__FILE__);
		$splashDir = dirname($modelsDirName);
		$splashVersion = basename($splashDir);
		
		$strExtentions = implode('|', $exludeExtentions);
		$strFolders = '^' . implode('|^', $exludeFolders);
		
		$str = "Options FollowSymLinks
		RewriteEngine on
		RewriteBase $rootUri
		
		#RewriteCond %{REQUEST_FILENAME} !-f
		#RewriteCond %{REQUEST_FILENAME} !-d
		
		RewriteRule !((\.($strExtentions)$)|$strFolders) vendor/mouf/mvc.splash/src/splash.php";
		
		file_put_contents(ROOT_PATH."../../../.htaccess", $str);
	}
	
	/**
	 * 
	 * @param string $sourceDirectory
	 * @param string $controllerNamespace
	 * @param string $viewDirectory
	 */
	public function generateRootController($sourceDirectory, $controllerNamespace, $viewDirectory) {
		
		$rootControllerStr = '<?php
namespace '.trim($controllerNamespace, '\\').';
				
use Mouf\\Html\\HtmlElement\\HtmlBlock;
use Mouf\\Html\\Template\\TemplateInterface;<commit_msg>Fix Apache 2.4.4 bug : options should have either "+" or "-"<commit_after><?php
namespace Mouf\Mvc\Splash;

/**
 * This class is in charge of all tasks that generate files:
 *  - .htaccess generation
 *  - controllers generation
 *  ...
 *  
 * @author david
 * @Component
 */
class SplashGenerateService {
	/**
	 * Writes the .htaccess file
	 * 
	 * @param string $rootUri
	 * @param array<string> $exludeExtentions
	 * @param array<string> $exludeFolders
	 */
	public function writeHtAccess($rootUri, $exludeExtentions, $exludeFolders) {

		$modelsDirName = dirname(__FILE__);
		$splashDir = dirname($modelsDirName);
		$splashVersion = basename($splashDir);
		
		$strExtentions = implode('|', $exludeExtentions);
		$strFolders = '^' . implode('|^', $exludeFolders);
		
		$str = "Options +FollowSymLinks
		RewriteEngine on
		RewriteBase $rootUri
		
		#RewriteCond %{REQUEST_FILENAME} !-f
		#RewriteCond %{REQUEST_FILENAME} !-d
		
		RewriteRule !((\.($strExtentions)$)|$strFolders) vendor/mouf/mvc.splash/src/splash.php";
		
		file_put_contents(ROOT_PATH."../../../.htaccess", $str);
	}
	
	/**
	 * 
	 * @param string $sourceDirectory
	 * @param string $controllerNamespace
	 * @param string $viewDirectory
	 */
	public function generateRootController($sourceDirectory, $controllerNamespace, $viewDirectory) {
		
		$rootControllerStr = '<?php
namespace '.trim($controllerNamespace, '\\').';
				
use Mouf\\Html\\HtmlElement\\HtmlBlock;
use Mouf\\Html\\Template\\TemplateInterface;
{'fraction_non_alphanumeric': 0.14914089347079038, 'fraction_numerical': 0.0010309278350515464, 'mean_word_length': 4.0802792321116925, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 7, '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': '3511777', 'n_tokens_mistral': 1076, 'n_tokens_neox': 945, 'n_words': 194}