<commit_before><?php
namespace DNode;

class Protocol
{
    private $wrapper;
    private $sessions = array();

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

    public function create()
    {
        // FIXME: Random ID generation, should be unique
        $id = time();
        $this->sessions[$id] = new Session($id, $this->wrapper);
        return $this->sessions[$id];
    }

    public function destroy($id)
    {
        unset($this->sessions[$id]);
    }

    public function end()
    {
        foreach ($this->sessions as $id => $session) {
            $this->sessions[$id]->end();
        }
    }

    public function parseArgs($args) {
        $params = array();

        foreach ($args as $arg) {
            if (is_string($arg)) {
                if (preg_match('/^\d+$/', $arg)) {
                    $params['port'] = $arg;
                    continue;
                }
                if (preg_match('/^\\//', $arg)) {
                    $params['path'] = $arg;<commit_msg>Use microtime as id in Protocol instead of time<commit_after><?php
namespace DNode;

class Protocol
{
    private $wrapper;
    private $sessions = array();

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

    public function create()
    {
        // FIXME: Random ID generation, should be unique
        $id = microtime();
        $this->sessions[$id] = new Session($id, $this->wrapper);
        return $this->sessions[$id];
    }

    public function destroy($id)
    {
        unset($this->sessions[$id]);
    }

    public function end()
    {
        foreach ($this->sessions as $id => $session) {
            $this->sessions[$id]->end();
        }
    }

    public function parseArgs($args) {
        $params = array();

        foreach ($args as $arg) {
            if (is_string($arg)) {
                if (preg_match('/^\d+$/', $arg)) {
                    $params['port'] = $arg;
                    continue;
                }
                if (preg_match('/^\\//', $arg)) {
                    $params['path'] = $arg;
{'fraction_non_alphanumeric': 0.15901561760530053, 'fraction_numerical': 0.0, 'mean_word_length': 1.679340937896071, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, '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': '4855766', 'n_tokens_mistral': 623, 'n_tokens_neox': 601, 'n_words': 143}