<commit_before><?php namespace Tolkien\Facades;

use Tolkien\Factories\BuildFactory;
use Tolkien\Factories\GenerateFactory;
use Tolkien\CompileSite;
use Symfony\Component\Yaml\Parser;

/**
 * Main class to provide simple API
 */
class Tolkien
{	

	/**
	 * Return config.yml location
	 *
	 * @param string $name
	 * @return $string
	 */
	public static function config($name)
	{
		return $name . '/config.yml';
	}

	/**
	 * API for build node
	 *
	 * @param string $name Blog's name
	 * @param string $type Type of Node
	 * @return void
	 */
	public static function build($name, $type)
	{
		$factory = new BuildFactory(self::config($name), $type);
		$buildNode = $factory->build();
		$buildNode->build();
		return $buildNode->getNodes();
	}

	/**
	 * API for generate node
	 *
	 * @param string $name Blog's name
	 * @param string $type Type of Nde
	 * @param array $properties Title, dll
	 * @return void
	 */
	public static function generate($name, $properties)
	{
		$factory = new GenerateFactory(self::config($name), $properties);
		$generateNode = $factory->generate();
		$generateNode->generate();
	}

	/**
	 * API for compile (create file)
	 *
	 * @param string $name
	 * @return void
	 */
	public static function compile($name)
	{
		$factory = new BuildFactory(self::config($name), 'site');
		$buildSite = $factory->build();

		$site = $buildSite->build();

		$parser = new Parser();
		$config = $parser->parse(file_get_contents( self::config($name) ));

		$loader = new \Twig_Loader_Filesystem( $config['dir']['layout'] );
		$twig = new \Twig_Environment($loader);

		$compiler = new CompileSite($site, $config, $twig);<commit_msg>add description on facade generate<commit_after><?php namespace Tolkien\Facades;

use Tolkien\Factories\BuildFactory;
use Tolkien\Factories\GenerateFactory;
use Tolkien\CompileSite;
use Symfony\Component\Yaml\Parser;

/**
 * Main class to provide simple API
 */
class Tolkien
{	

	/**
	 * Return config.yml location
	 *
	 * @param string $name
	 * @return $string
	 */
	public static function config($name)
	{
		return $name . '/config.yml';
	}

	/**
	 * API for build node
	 *
	 * @param string $name Blog's name
	 * @param string $type Type of Node
	 * @return void
	 */
	public static function build($name, $type)
	{
		$factory = new BuildFactory(self::config($name), $type);
		$buildNode = $factory->build();
		$buildNode->build();
		return $buildNode->getNodes();
	}

	/**
	 * API for generate node
	 *
	 * @param string $name Blog's name
	 * @param string $type Type of Nde
	 * @param array $properties Title, dll
	 * @return void
	 */
	public static function generate($name, $properties)
	{
		/**
		 * $properties
		 *
		 * for Page : array(type, title, layout, body)
		 * for Post : array(type, title, layout, author, categories, body)
		 */
		$factory = new GenerateFactory(self::config($name), $properties);
		$generateNode = $factory->generate();
		$generateNode->generate();
	}

	/**
	 * API for compile (create file)
	 *
	 * @param string $name
	 * @return void
	 */
	public static function compile($name)
	{
		$factory = new BuildFactory(self::config($name), 'site');
		$buildSite = $factory->build();

		$site = $buildSite->build();

		$parser = new Parser();
		$config = $parser->parse(file_get_contents( self::config($name) ));

		$loader = new \Twig_Loader_Filesystem( $config['dir']['layout'] );
		$twig = new \Twig_Environment($loader);

		$compiler = new CompileSite($site, $config, $twig);
{'fraction_non_alphanumeric': 0.15714699913018265, 'fraction_numerical': 0.0, 'mean_word_length': 3.8797736916548797, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, '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': '340392', 'n_tokens_mistral': 1196, 'n_tokens_neox': 1082, 'n_words': 296}