<commit_before><?php
/**
 * This file is part of the Imbo package
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE file that was
 * distributed with this source code.
 */

use Behat\Behat\Context\BehatContext,
    Behat\Behat\Exception\PendingException,
    Behat\Behat\Event\SuiteEvent,
    Behat\Gherkin\Node\PyStringNode,
    Guzzle\Http\Client,
    Guzzle\Http\Message\Request,
    Guzzle\Http\Message\Response;

// PHPUnit related classes
require 'src/Framework/Assert/Functions.php';
require 'src/CodeCoverage.php';
require 'src/CodeCoverage/Filter.php';
require 'src/CodeCoverage/Report/HTML.php';

/**
 * REST context for Behat tests
 *
 * @author <NAME> <<EMAIL>>
 * @package Test suite\Functional tests
 */
class RESTContext extends BehatContext {
    /**
     * Guzzle client used to make requests against the httpd
     *
     * @var Client
     */
    protected $client;

    /**
     * The current response objects used by the client (populated when the request is sent)
     *
     * @var Response[]
     */
    protected $responses = array();

    /**
     * Headers for the request
     *
     * @var array
     */
    protected $requestHeaders = array();

    /**
     * Optional request body to add to the request
     *
     * @var string
     */
    protected $requestBody;

    /**
     * The previously requested path
     *
     * @var string
     */
    private $prevRequestedPath;

    /**
     * The current test session id
     *
     * @var string
     */
    private static $testSessionId;

    /**
     * Parameters from the configuration
     *
     * @var array
     */
    private $params;

    /**
     * Class constructor
     *
     * @param array $parameters Context parameters
     */
    public function __construct(array $parameters) {
        $this->params = $parameters;
        $this->createClient();
    }

    /**
     * Returns a list of HTTP verbs that we need to do an override of in order
     * to bypass limitations in the built-in PHP server.
     *
     * The returned list contains the verb to use override for, and what verb
     * to use when overriding. For instance POST could be used when we want to
     * perform a SEARCH request as a payload is expected while GET could be used
     * if we want to test something using the LINK method.
     */
    private function getOverrideVerbs() {
        return [
            'SEARCH' => 'POST'
        ];
    }

    /**
     * Create a new HTTP client
     */
    private function createClient() {
        $this->client = new Client($this->params['url']);

        $defaultHeaders = array(<commit_msg>Update docblock comment<commit_after><?php
/**
 * This file is part of the Imbo package
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE file that was
 * distributed with this source code.
 */

use Behat\Behat\Context\BehatContext,
    Behat\Behat\Exception\PendingException,
    Behat\Behat\Event\SuiteEvent,
    Behat\Gherkin\Node\PyStringNode,
    Guzzle\Http\Client,
    Guzzle\Http\Message\Request,
    Guzzle\Http\Message\Response;

// PHPUnit related classes
require 'src/Framework/Assert/Functions.php';
require 'src/CodeCoverage.php';
require 'src/CodeCoverage/Filter.php';
require 'src/CodeCoverage/Report/HTML.php';

/**
 * REST context for Behat tests
 *
 * @author <NAME> <<EMAIL>>
 * @package Test suite\Functional tests
 */
class RESTContext extends BehatContext {
    /**
     * Guzzle client used to make requests against the httpd
     *
     * @var Client
     */
    protected $client;

    /**
     * The current response objects used by the client (populated when the request is sent)
     *
     * @var Response[]
     */
    protected $responses = array();

    /**
     * Headers for the request
     *
     * @var array
     */
    protected $requestHeaders = array();

    /**
     * Optional request body to add to the request
     *
     * @var string
     */
    protected $requestBody;

    /**
     * The previously requested path
     *
     * @var string
     */
    private $prevRequestedPath;

    /**
     * The current test session id
     *
     * @var string
     */
    private static $testSessionId;

    /**
     * Parameters from the configuration
     *
     * @var array
     */
    private $params;

    /**
     * Class constructor
     *
     * @param array $parameters Context parameters
     */
    public function __construct(array $parameters) {
        $this->params = $parameters;
        $this->createClient();
    }

    /**
     * Returns a list of HTTP verbs that we need to do an override of in order
     * to bypass limitations in the built-in PHP HTTP server.
     *
     * The returned list contains the verb to use override for, and what verb
     * to use when overriding. For instance POST could be used when we want to
     * perform a SEARCH request as a payload is expected while GET could be used
     * if we want to test something using the LINK method.
     */
    private function getOverrideVerbs() {
        return [
            'SEARCH' => 'POST'
        ];
    }

    /**
     * Create a new HTTP client
     */
    private function createClient() {
        $this->client = new Client($this->params['url']);

        $defaultHeaders = array(
{'fraction_non_alphanumeric': 0.10080569608394228, 'fraction_numerical': 0.0, 'mean_word_length': 2.2909987669543774, 'pattern_counts': {'":': 0, '<': 17, '<?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': '806601', 'n_tokens_mistral': 1525, 'n_tokens_neox': 1479, 'n_words': 508}