<commit_before><?php
declare (strict_types = 1);

namespace GrottoPress\Jentil\Utilities\ThemeMods;

class Posts extends AbstractThemeMod
{
    /**
     * @var ThemeMods
     */
    private $themeMods;

    /**
     * @var string $setting Post setting to retrieve
     */
    private $setting;

    /**
     * @var string
     */
    private $context;

    /**
     * @var string $specific Post type or taxonomy name.
     */
    private $specific;

    /**
     * @var int $moreSpecific Post ID or term ID.
     */
    private $moreSpecific;

    /**
     * @param mixed[string] $args
     */
    public function __construct(
        ThemeMods $theme_mods,
        string $setting,
        array $args = []
    ) {
        $this->themeMods = $theme_mods;

        $this->setAttributes($setting, $args);
    }

    /**
     * @param mixed[string] $args
     */
    private function setAttributes(string $setting, array $args = [])
    {
        $args = \wp_parse_args($args, [
            'context' => '',
            'specific' => '',
            'more_specific' => 0,
        ]);

        $this->setting = \sanitize_key($setting);
        $this->context = \sanitize_key($args['context']);
        $this->specific = \sanitize_key($args['specific']);
        $this->moreSpecific = (int)$args['more_specific'];

        $ids = $this->ids();
        $this->id = isset($ids[$this->context])
            ? \sanitize_key($ids[$this->context]) : '';

        $defaults = $this->defaults();
        $this->default = $defaults[$this->setting] ?? null;
    }

    /**
     * @return string[string]
     */
    private function ids(): array
    {
        $ids = [
            'home' => 'post_post_type_posts',
            'singular' => "singular_{$this->specific}_{$this->moreSpecific}_posts",
            'author' => 'author_posts',
            'category' => "category_{$this->moreSpecific}_taxonomy_posts",
            'date' => 'date_posts',
            'post_type_archive' => "{$this->specific}_post_type_posts",
            'tag' => "post_tag_{$this->moreSpecific}_taxonomy_posts",
            'tax' => "{$this->specific}_{$this->moreSpecific}_taxonomy_posts",
            'search' => 'search_posts',
            'sticky' => "{$this->specific}_sticky_posts",
            'related' => "{$this->specific}_related_posts",
        ];

        $ids = \array_map(function (string $value): string {
            $value .= "_{$this->setting}";
            $value = \str_replace(['__', '_0_'], '_', $value);
            return \trim($value, '_');
        }, $ids);

        return \apply_filters(
            'jentil_posts_mod_id',
            $ids,
            $this->setting,
            $this->context,
            $this->specific,
            $this->moreSpecific
        );
    }

    /**
     * @return mixed[string]
     */
    private function defaults(): array
    {
        $defaults = [
            'wrap_class' => 'archive-posts big',
            'wrap_tag' => 'div',
            'layout' => 'stack',
            'number' => (int)\get_option('posts_per_page'),
            'before_title' => '',
            'before_title_separator' => ' | ',
            'title_words' => -1,<commit_msg>Unset default posts layout mod<commit_after><?php
declare (strict_types = 1);

namespace GrottoPress\Jentil\Utilities\ThemeMods;

class Posts extends AbstractThemeMod
{
    /**
     * @var ThemeMods
     */
    private $themeMods;

    /**
     * @var string $setting Post setting to retrieve
     */
    private $setting;

    /**
     * @var string
     */
    private $context;

    /**
     * @var string $specific Post type or taxonomy name.
     */
    private $specific;

    /**
     * @var int $moreSpecific Post ID or term ID.
     */
    private $moreSpecific;

    /**
     * @param mixed[string] $args
     */
    public function __construct(
        ThemeMods $theme_mods,
        string $setting,
        array $args = []
    ) {
        $this->themeMods = $theme_mods;

        $this->setAttributes($setting, $args);
    }

    /**
     * @param mixed[string] $args
     */
    private function setAttributes(string $setting, array $args = [])
    {
        $args = \wp_parse_args($args, [
            'context' => '',
            'specific' => '',
            'more_specific' => 0,
        ]);

        $this->setting = \sanitize_key($setting);
        $this->context = \sanitize_key($args['context']);
        $this->specific = \sanitize_key($args['specific']);
        $this->moreSpecific = (int)$args['more_specific'];

        $ids = $this->ids();
        $this->id = isset($ids[$this->context])
            ? \sanitize_key($ids[$this->context]) : '';

        $defaults = $this->defaults();
        $this->default = $defaults[$this->setting] ?? null;
    }

    /**
     * @return string[string]
     */
    private function ids(): array
    {
        $ids = [
            'home' => 'post_post_type_posts',
            'singular' => "singular_{$this->specific}_{$this->moreSpecific}_posts",
            'author' => 'author_posts',
            'category' => "category_{$this->moreSpecific}_taxonomy_posts",
            'date' => 'date_posts',
            'post_type_archive' => "{$this->specific}_post_type_posts",
            'tag' => "post_tag_{$this->moreSpecific}_taxonomy_posts",
            'tax' => "{$this->specific}_{$this->moreSpecific}_taxonomy_posts",
            'search' => 'search_posts',
            'sticky' => "{$this->specific}_sticky_posts",
            'related' => "{$this->specific}_related_posts",
        ];

        $ids = \array_map(function (string $value): string {
            $value .= "_{$this->setting}";
            $value = \str_replace(['__', '_0_'], '_', $value);
            return \trim($value, '_');
        }, $ids);

        return \apply_filters(
            'jentil_posts_mod_id',
            $ids,
            $this->setting,
            $this->context,
            $this->specific,
            $this->moreSpecific
        );
    }

    /**
     * @return mixed[string]
     */
    private function defaults(): array
    {
        $defaults = [
            'wrap_class' => 'archive-posts big',
            'wrap_tag' => 'div',
            'layout' => '',
            'number' => (int)\get_option('posts_per_page'),
            'before_title' => '',
            'before_title_separator' => ' | ',
            'title_words' => -1,
{'fraction_non_alphanumeric': 0.16907151819322458, 'fraction_numerical': 0.0012547051442910915, 'mean_word_length': 1.9454965357967668, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 99, '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': '3214633', 'n_tokens_mistral': 1932, 'n_tokens_neox': 1889, 'n_words': 336}