<commit_before><?php
/**
 *  ClearCache.php
 *
 *  @author     <NAME> <<EMAIL>>
 */
namespace Ethnam\Generator\Subcommand;

use Ethnam\Generator\Command as Ethna_Command;

/**
 *  clear-cache handler
 *
 *  @author     <NAME> <<EMAIL>>
 *  @access     public
 */
class ClearCache extends Base
{
    /**
     *
     *  @todo   implement Ethna_Renderer::clear_cache();
     *  @todo   implement Ethna_Plugin_Cachemanager::clear_cache();
     *  @todo   avoid echo, printf
     */
    public function perform()
    {
        $r = $this->_getopt(array('basedir=',
                                   'any-tmp-files', 'smarty', 'pear', 'cachemanager'));
        list($args, ) = $r;

        $basedir = isset($args['basedir']) ? realpath(end($args['basedir'])) : getcwd();
        $controller = Ethna_Command::getAppController($basedir);
        if (Ethna::isError($controller)) {
            return $controller;
        }
        $tmp_dir = $controller->getDirectory('tmp');

        if (isset($args['smarty']) || isset($args['any-tmp-files'])) {
            echo "cleaning smarty caches, compiled templates...";
            $renderer = $controller->getRenderer();<commit_msg>use Ethna_Util<commit_after><?php
/**
 *  ClearCache.php
 *
 *  @author     <NAME> <<EMAIL>>
 */
namespace Ethnam\Generator\Subcommand;

use Ethnam\Generator\Command as Ethna_Command;

use Ethna_Util;
use Ethna;

/**
 *  clear-cache handler
 *
 *  @author     <NAME> <<EMAIL>>
 *  @access     public
 */
class ClearCache extends Base
{
    /**
     *
     *  @todo   implement Ethna_Renderer::clear_cache();
     *  @todo   implement Ethna_Plugin_Cachemanager::clear_cache();
     *  @todo   avoid echo, printf
     */
    public function perform()
    {
        $r = $this->_getopt(array('basedir=',
                                   'any-tmp-files', 'smarty', 'pear', 'cachemanager'));
        list($args, ) = $r;

        $basedir = isset($args['basedir']) ? realpath(end($args['basedir'])) : getcwd();
        $controller = Ethna_Command::getAppController($basedir);
        if (Ethna::isError($controller)) {
            return $controller;
        }
        $tmp_dir = $controller->getDirectory('tmp');

        if (isset($args['smarty']) || isset($args['any-tmp-files'])) {
            echo "cleaning smarty caches, compiled templates...";
            $renderer = $controller->getRenderer();
{'fraction_non_alphanumeric': 0.16462642465175178, 'fraction_numerical': 0.0, 'mean_word_length': 2.553223388305847, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 21, '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': '6934018', 'n_tokens_mistral': 732, 'n_tokens_neox': 735, 'n_words': 136}