<commit_before><?php

namespace DataSift\Storyplayer\UserLib;

use stdClass;
use DataSift\Stone\PasswordLib\BasicGenerator;
use DataSift\Storyplayer\StoryLib\Story;
use DataSift\Storyplayer\PlayerLib\StoryContext;
use DataSift\Storyplayer\PlayerLib\StoryCheckpoint;

class ConfigUserLoader implements UserGenerator
{
    protected $generator;

    public function __construct($generator)
    {
        $this->generator = $generator;
    }

    public function getUser($staticConfig, $runtimeConfig, StoryContext $context, Story $story)
    {
        // what environment are we working in?
        $envName = $context->env->envName;

        // do we have a cached user from telleroftales, or a previous
        // storyplayer?
        if (isset($runtimeConfig->users, $runtimeConfig->users->$envName))
        {
            $user = new User();
            $user->mergeFrom($runtimeConfig->users->$envName);
            $runtimeConfig->users->$envName = $user;

            return $user;
        }

        // if we get here, then there's no previous user to reuse
        if (!isset($runtimeConfig->users)) {
            $runtimeConfig->users = (object)array();
        }
        $runtimeConfig->users->$envName = $this->generator->getUser($staticConfig, $runtimeConfig, $context, $story);

        // all done
        return $runtimeConfig->users->$envName;
    }

    public function storeUser($user, $staticConfig, $runtimeConfig)
    {
        // no action required
    }

    public function emptyCache($staticConfig, $runtimeConfig, StoryContext $context)
    {
        // can't do anything
    }
}<commit_msg>Fix: do not use $env->envName any more<commit_after><?php

namespace DataSift\Storyplayer\UserLib;

use stdClass;
use DataSift\Stone\PasswordLib\BasicGenerator;
use DataSift\Storyplayer\StoryLib\Story;
use DataSift\Storyplayer\PlayerLib\StoryContext;
use DataSift\Storyplayer\PlayerLib\StoryCheckpoint;

class ConfigUserLoader implements UserGenerator
{
    protected $generator;

    public function __construct($generator)
    {
        $this->generator = $generator;
    }

    public function getUser($staticConfig, $runtimeConfig, StoryContext $context, Story $story)
    {
        // what environment are we working in?
        $envName = $context->envName;

        // do we have a cached user from telleroftales, or a previous
        // storyplayer?
        if (isset($runtimeConfig->users, $runtimeConfig->users->$envName))
        {
            $user = new User();
            $user->mergeFrom($runtimeConfig->users->$envName);
            $runtimeConfig->users->$envName = $user;

            return $user;
        }

        // if we get here, then there's no previous user to reuse
        if (!isset($runtimeConfig->users)) {
            $runtimeConfig->users = (object)array();
        }
        $runtimeConfig->users->$envName = $this->generator->getUser($staticConfig, $runtimeConfig, $context, $story);

        // all done
        return $runtimeConfig->users->$envName;
    }

    public function storeUser($user, $staticConfig, $runtimeConfig)
    {
        // no action required
    }

    public function emptyCache($staticConfig, $runtimeConfig, StoryContext $context)
    {
        // can't do anything
    }
}
{'fraction_non_alphanumeric': 0.11685116851168512, 'fraction_numerical': 0.0, 'mean_word_length': 2.769409038238702, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 41, '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': '7147861', 'n_tokens_mistral': 924, 'n_tokens_neox': 884, 'n_words': 214}