<commit_before><?php

namespace actsmart\actsmart\Stores;

use actsmart\actsmart\Actuators\ActionEvent;
use actsmart\actsmart\Utils\Literals;
use Ds\Map;
use Symfony\Component\EventDispatcher\GenericEvent;

/**
 * Class ContextStore
 * @package actsmart\actsmart\Stores
 *
 * Stores information for the duration of a single call in a [type][id][value] structure.
 */
abstract class EphemeralStore extends BaseStore
{
    /* @var Map $store */
    protected $store;

    public function __construct() {
        $this->store = new Map();
    }

    public function storeInformation(InformationInterface $information)
    {
        if ($this->store->hasKey($information->getType())) {
            $typeStore = $this->store->get($information->getType());
            $typeStore[$information->getId()] = $information->getValue();
        } else {
            $typeStore = [$information->getId() => $information->getValue()];
            $this->store->put($information->getType(), $typeStore);
        }

        return $this;
    }

    public function getInformation(string $type = '', string $id = '', Map $arguments = null)
    {
        if ($this->informationExists($type, $id)) {
            $information = new ContextInformation($type, $id, $this->store->get($type)[$id]);
            return $information;<commit_msg>Fix saving multiple items of the same type.<commit_after><?php

namespace actsmart\actsmart\Stores;

use actsmart\actsmart\Actuators\ActionEvent;
use actsmart\actsmart\Utils\Literals;
use Ds\Map;
use Symfony\Component\EventDispatcher\GenericEvent;

/**
 * Class ContextStore
 * @package actsmart\actsmart\Stores
 *
 * Stores information for the duration of a single call in a [type][id][value] structure.
 */
abstract class EphemeralStore extends BaseStore
{
    /* @var Map $store */
    protected $store;

    public function __construct() {
        $this->store = new Map();
    }

    public function storeInformation(InformationInterface $information)
    {
        if ($this->store->hasKey($information->getType())) {
            $typeStore = $this->store->get($information->getType());
            $typeStore[$information->getId()] = $information->getValue();
            $this->store->put($information->getType(), $typeStore);
        } else {
            $typeStore = [$information->getId() => $information->getValue()];
            $this->store->put($information->getType(), $typeStore);
        }

        return $this;
    }

    public function getInformation(string $type = '', string $id = '', Map $arguments = null)
    {
        if ($this->informationExists($type, $id)) {
            $information = new ContextInformation($type, $id, $this->store->get($type)[$id]);
            return $information;
{'fraction_non_alphanumeric': 0.14923189465983908, 'fraction_numerical': 0.0, 'mean_word_length': 3.1819571865443423, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 42, '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': '3077008', 'n_tokens_mistral': 753, 'n_tokens_neox': 742, 'n_words': 170}