<commit_before><?php
namespace Etcd\API;

class V2 implements \Etcd\Interfaces\API {

    private $connection;

    private function getEndpoint($key)
    {
        return $this->connection->getKeyEndpoint($key);
    }

    public function __construct($connection)
    {
        $this->connection = $connection;
        $this->setParser(new \Etcd\API\V2\Parser);
    }

    public function setParser(\Etcd\Interfaces\Parser $parser)
    {
        $this->parser = $parser;
        $this->parser->setAPI($this);
    }

    public function create($key, $value, $options = array())
    {
        $uri = $this->getEndpoint($key);

        $body = array_merge(array('value' => $value), $options);

        $response = $this->connection->post($uri,array('body' => $body, 'exceptions' => false));

        return $this->parser->parse($response->json());
    }

    public function set($key, $value, $options = array())
    {
        $uri = $this->getEndpoint($key);

        $body = array_merge(array('value' => $value), $options);

        $response = $this->connection->put($uri,array('body' => $body, 'exceptions' => false));

        return $this->parser->parse($response->json());
    }
    
    public function get($key)
    {
        $uri = $this->getEndpoint($key);

        $response = $this->connection->get($uri,array('exceptions' => false));

        return $this->parser->parse($response->json());
    }

    public function delete($key, $dir = false, $recursive = false)
    {
        $uri = $this->getEndpoint($key);

        $query = array();
        if($dir) {
            $query['dir'] = 'true';
        }
        if($recursive) {
            $query['recursive'] = 'true';
        }

        $response = $this->connection->delete($uri,array('exceptions' => false, 'query' => $query));

        return $this->parser->parse($response->json());
    }
}<commit_msg>correct the create syntax<commit_after><?php
namespace Etcd\API;

class V2 implements \Etcd\Interfaces\API {

    private $connection;

    private function getEndpoint($key)
    {
        return $this->connection->getKeyEndpoint($key);
    }

    public function __construct($connection)
    {
        $this->connection = $connection;
        $this->setParser(new \Etcd\API\V2\Parser);
    }

    public function setParser(\Etcd\Interfaces\Parser $parser)
    {
        $this->parser = $parser;
        $this->parser->setAPI($this);
    }

    public function create($key, $value, $options = array())
    {
        $uri = $this->getEndpoint($key);

        $body = array_merge(array('value' => $value), $options);

        $response = $this->connection->put($uri,array('body' => $body, 'exceptions' => false));

        return $this->parser->parse($response->json());
    }

    public function set($key, $value, $options = array())
    {
        $uri = $this->getEndpoint($key);

        $body = array_merge(array('value' => $value), $options);

        $response = $this->connection->put($uri,array('body' => $body, 'exceptions' => false));

        return $this->parser->parse($response->json());
    }
    
    public function get($key)
    {
        $uri = $this->getEndpoint($key);

        $response = $this->connection->get($uri,array('exceptions' => false));

        return $this->parser->parse($response->json());
    }

    public function delete($key, $dir = false, $recursive = false)
    {
        $uri = $this->getEndpoint($key);

        $query = array();
        if($dir) {
            $query['dir'] = 'true';
        }
        if($recursive) {
            $query['recursive'] = 'true';
        }

        $response = $this->connection->delete($uri,array('exceptions' => false, 'query' => $query));

        return $this->parser->parse($response->json());
    }
}
{'fraction_non_alphanumeric': 0.18705035971223022, 'fraction_numerical': 0.0010658140154543032, 'mean_word_length': 2.6165703275529864, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 83, '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': '5032804', 'n_tokens_mistral': 1152, 'n_tokens_neox': 1106, 'n_words': 203}