<commit_before><?php
namespace Czim\PxlCms\Generator\Analyzer\Steps;
use Czim\PxlCms\Generator\Generator;

/**
 * Analyzes models to see if they might be candidates for making sluggable.
 *
 * Interactive: asks whether you the user wants to add sluggable and for which column.
 */
class AnalyzeSluggableInteractive extends AbstractProcessStep
{
    const SLUGGABLE_NORMAL      = 'normal';
    const SLUGGABLE_TRANSLATED  = 'translated';
    const SLUGGABLE_SLUG_COLUMN = 'slug_column';

    /**
     * Which modules (ID values) to not slug
     *
     * @var array
     */
    protected $excludes = [];

    /**
     * Override sluggable setup for modules, keyed by module ID
     * @var array
     */
    protected $overrides = [];


    protected function process()
    {
        $this->excludes  = config('pxlcms.generator.override.sluggable.exclude');
        $this->overrides = config('pxlcms.generator.override.sluggable.force');


        // if slug handling is disabled entirely, do not perform this step
        if ( ! config('pxlcms.generator.models.slugs.enable')) {

            $this->context->log("Skipping slug analysis (disabled).");
            return;
        }

        // analyze which models might be candidates for sluggable
        // note that it will have to keep track of whether it is a translated slug source
        $candidates = $this->findSluggableCandidateModels();


        if ($this->isInteractive()) {

            // if a model has one sluggable column, ask a y/n for it<commit_msg>WIP commont on sluggable analysis step<commit_after><?php
namespace Czim\PxlCms\Generator\Analyzer\Steps;
use Czim\PxlCms\Generator\Generator;

/**
 * Analyzes models to see if they might be candidates for making sluggable.
 *
 * Interactive: asks whether you the user wants to add sluggable and for which column.
 */
class AnalyzeSluggableInteractive extends AbstractProcessStep
{
    const SLUGGABLE_NORMAL      = 'normal';
    const SLUGGABLE_TRANSLATED  = 'translated';
    const SLUGGABLE_SLUG_COLUMN = 'slug_column';

    /**
     * Which modules (ID values) to not slug
     *
     * @var array
     */
    protected $excludes = [];

    /**
     * Override sluggable setup for modules, keyed by module ID
     * @var array
     */
    protected $overrides = [];


    protected function process()
    {
        $this->excludes  = config('pxlcms.generator.override.sluggable.exclude');
        $this->overrides = config('pxlcms.generator.override.sluggable.force');


        // if slug handling is disabled entirely, do not perform this step
        if ( ! config('pxlcms.generator.models.slugs.enable')) {

            $this->context->log("Skipping slug analysis (disabled).");
            return;
        }

        // analyze which models might be candidates for sluggable
        // note that it will have to keep track of whether it is a translated slug source
        $candidates = $this->findSluggableCandidateModels();

        // if a model is to be sluggable'd, set its 'sluggable' property to true
        // and add the 'sluggable_setup' array, with a 'translated' key (which indicates whether
        // the parent model or the translated model is to be affected), the optional 'slug' and
        // required 'source' attribute.

        if ($this->isInteractive()) {

            // if a model has one sluggable column, ask a y/n for it
{'fraction_non_alphanumeric': 0.09683150725496002, 'fraction_numerical': 0.0, 'mean_word_length': 2.679738562091503, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '372486', 'n_tokens_mistral': 977, 'n_tokens_neox': 947, 'n_words': 313}