<commit_before><?php
namespace watoki\collections;

use watoki\collections\events\MapSetEvent;
use watoki\collections\events\MapRemoveEvent;

/**
 * Contains a key-value map of elements.
 */
class Map extends Collection {

    static $CLASSNAME = __CLASS__;

    /**
     * @param mixed $key
     * @param mixed $value
     * @return void
     */
    public function set($key, $value) {
        $this->elements[$this->hash($key)] = $value;
        $this->fire(new MapSetEvent($key, $value));
    }

    /**
     * @param mixed $key
     * @throws \InvalidArgumentException
     * @return mixed Element with given key
     */
    public function get($key) {
        $hash = $this->hash($key);
        $value = $this->elements[$hash];
        return $value;
    }

    /**
     * Removes element with given key.
     *
     * @param mixed $key
     * @return void
     */
    public function remove($key) {
        $value = $this->elements[$this->hash($key)];
        unset($this->elements[$this->hash($key)]);
        $this->fire(new MapRemoveEvent($key, $value));
    }

    /**
     * @return Set With the values of this map.
     */
    public function values() {
        return new Set($this->elements);
    }

    /**
     * @return Set With key of this map as elements.
     */
    public function keys() {<commit_msg>Map.remove returns removed value<commit_after><?php
namespace watoki\collections;

use watoki\collections\events\MapSetEvent;
use watoki\collections\events\MapRemoveEvent;

/**
 * Contains a key-value map of elements.
 */
class Map extends Collection {

    static $CLASSNAME = __CLASS__;

    /**
     * @param mixed $key
     * @param mixed $value
     * @return void
     */
    public function set($key, $value) {
        $this->elements[$this->hash($key)] = $value;
        $this->fire(new MapSetEvent($key, $value));
    }

    /**
     * @param mixed $key
     * @throws \InvalidArgumentException
     * @return mixed Element with given key
     */
    public function get($key) {
        $hash = $this->hash($key);
        $value = $this->elements[$hash];
        return $value;
    }

    /**
     * Removes element with given key.
     *
     * @param mixed $key
     * @return mixed The value of the removed key
     */
    public function remove($key) {
        $value = $this->elements[$this->hash($key)];
        unset($this->elements[$this->hash($key)]);
        $this->fire(new MapRemoveEvent($key, $value));
        return $value;
    }

    /**
     * @return Set With the values of this map.
     */
    public function values() {
        return new Set($this->elements);
    }

    /**
     * @return Set With key of this map as elements.
     */
    public function keys() {
{'fraction_non_alphanumeric': 0.14532744665194997, 'fraction_numerical': 0.0, 'mean_word_length': 2.2798552472858864, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 25, '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': '7224588', 'n_tokens_mistral': 814, 'n_tokens_neox': 801, 'n_words': 215}