<commit_before><?php

/**
 * @copyright 2016 <NAME>
 * @license   https://github.com/allejo/stakx/blob/master/LICENSE.md MIT
 */

namespace allejo\stakx\Object;

use allejo\stakx\FrontMatter\ExpandedValue;

class RepeaterPageView extends PageView
{
    /**
     * @var \ArrayIterator
     */
    private $permalinksIterator;

    /**
     * @var \ArrayIterator
     */
    private $redirectsIterator;

    private $permalinks;
    private $redirects;

    private $configured;

    public function __construct($filePath)
    {
        parent::__construct($filePath);

        $this->frontMatterBlacklist = array();
        $this->type = PageView::REPEATER_TYPE;
        $this->configured = false;
    }

    /**
     * @return ExpandedValue[]
     */
    public function getRepeaterPermalinks ()
    {
        $this->configureValues();

        return $this->permalinks;
    }

    public function getRepeaterRedirects ()
    {
        $this->configureValues();

        return $this->redirects;
    }

    public function bump ()
    {
        $this->permalink = $this->permalinksIterator->current()->getEvaluated();
        $this->redirects = $this->redirectsIterator->current();

        $this->permalinksIterator->next();
        $this->redirectsIterator->next();
    }

    private function configureValues ()
    {
        if (!$this->configured)
        {
            $this->getFrontMatter();
            $evaluated = $this->frontMatter['permalink'];

            $this->permalinks = $evaluated[0];
            array_shift($evaluated);
            $this->redirects = $evaluated;

            $this->permalinksIterator = new \ArrayIterator($this->permalinks);
            $this->redirectsIterator  = new \ArrayIterator($this->redirects);

            $this->configured = true;
        }
    }
}<commit_msg>Shorten an if statement for configuration<commit_after><?php

/**
 * @copyright 2016 <NAME>
 * @license   https://github.com/allejo/stakx/blob/master/LICENSE.md MIT
 */

namespace allejo\stakx\Object;

use allejo\stakx\FrontMatter\ExpandedValue;

class RepeaterPageView extends PageView
{
    /**
     * @var \ArrayIterator
     */
    private $permalinksIterator;

    /**
     * @var \ArrayIterator
     */
    private $redirectsIterator;

    private $permalinks;
    private $redirects;

    private $configured;

    public function __construct($filePath)
    {
        parent::__construct($filePath);

        $this->frontMatterBlacklist = array();
        $this->type = PageView::REPEATER_TYPE;
        $this->configured = false;
    }

    /**
     * @return ExpandedValue[]
     */
    public function getRepeaterPermalinks ()
    {
        $this->configureValues();

        return $this->permalinks;
    }

    public function getRepeaterRedirects ()
    {
        $this->configureValues();

        return $this->redirects;
    }

    public function bump ()
    {
        $this->permalink = $this->permalinksIterator->current()->getEvaluated();
        $this->redirects = $this->redirectsIterator->current();

        $this->permalinksIterator->next();
        $this->redirectsIterator->next();
    }

    private function configureValues ()
    {
        if ($this->configured) { return; }

        $this->getFrontMatter();
        $evaluated = $this->frontMatter['permalink'];

        $this->permalinks = $evaluated[0];
        array_shift($evaluated);
        $this->redirects = $evaluated;

        $this->permalinksIterator = new \ArrayIterator($this->permalinks);
        $this->redirectsIterator  = new \ArrayIterator($this->redirects);

        $this->configured = true;
    }
}
{'fraction_non_alphanumeric': 0.1378737541528239, 'fraction_numerical': 0.0027685492801771874, 'mean_word_length': 2.4673704414587334, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 61, 'https://': 2, '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': '4530878', 'n_tokens_mistral': 1100, 'n_tokens_neox': 1060, 'n_words': 172}