<commit_before><?php
/**
 * PHP version 5.3
 *
 * @category Iml
 * @package  SaaS
 * @author   Sergey <<EMAIL>>
 * @license  http://opensource.org/licenses/MIT MIT License
 * @link     http://github.com/gwinn/saas-connector
 */

namespace SaaS\Service\Iml;

use SaaS\Exception\CurlException;
use SaaS\Http\Response;

/**
 * Tiu request class
 *
 * @category Iml
 * @package  SaaS
 * @author   Sergey <<EMAIL>>
 * @license  http://opensource.org/licenses/MIT MIT License
 * @link     http://github.com/gwinn/saas-connector
 */
class Request
{
    const METHOD_GET = 'GET';
    const METHOD_POST = 'POST';

    public $auth;

    /*
     * get auth
     *
     * @return string
     *
     */
    public function __construct($login, $password) {

        $this->auth= $login . ':' . $password;

    }

    /**
     * Make HTTP request
     *
     * @param string $path       method path
     * @param string $method     (default: 'GET')
     * @param array  $parameters (default: array())
     *
     * @return Response
     */
    public function makeRequest($path, $method, array $parameters = array()){

        $headers = array('Content-Type: application/json');
        
        $allowedMethods = array(
            self::METHOD_GET,
            self::METHOD_POST
        );

        $apiListMethods = array(
            'deliverystatus',
            'orderstatus',
            'region',
            'service'
        );

        if (!in_array($method, $allowedMethods)) {
            throw new \InvalidArgumentException(
                sprintf(
                    'Method "%s" is not valid. Allowed methods are %s',
                    $method,
                    implode(', ', $allowedMethods)
                )
            );
        }

        if (self::METHOD_GET === $method && in_array($path, $apiListMethods)){
            $url = 'https://api.iml.ru/json/';
        } elseif(self::METHOD_GET === $method && !in_array($path, $apiListMethods)){
            $url = 'https://list.iml.ru/';
        }else {
            $url = 'https://api.iml.ru/json/';
        }

        if (self::METHOD_GET === $method){
           $path .= '?' . http_build_query($parameters, '', '&');<commit_msg>Fix IML service request (#13)<commit_after><?php
/**
 * PHP version 5.3
 *
 * @category Iml
 * @package  SaaS
 * @author   Sergey <<EMAIL>>
 * @license  http://opensource.org/licenses/MIT MIT License
 * @link     http://github.com/gwinn/saas-connector
 */

namespace SaaS\Service\Iml;

use SaaS\Exception\CurlException;
use SaaS\Http\Response;

/**
 * Tiu request class
 *
 * @category Iml
 * @package  SaaS
 * @author   Sergey <<EMAIL>>
 * @license  http://opensource.org/licenses/MIT MIT License
 * @link     http://github.com/gwinn/saas-connector
 */
class Request
{
    const METHOD_GET = 'GET';
    const METHOD_POST = 'POST';

    public $auth;

    /*
     * get auth
     *
     * @return string
     *
     */
    public function __construct($login, $password) {

        $this->auth= $login . ':' . $password;

    }

    /**
     * Make HTTP request
     *
     * @param string $path       method path
     * @param string $method     (default: 'GET')
     * @param array  $parameters (default: array())
     *
     * @return Response
     */
    public function makeRequest($path, $method, array $parameters = array()){

        $headers = array('Content-Type: application/json');
        
        $allowedMethods = array(
            self::METHOD_GET,
            self::METHOD_POST
        );

        $apiListMethods = array(
            'deliverystatus',
            'orderstatus',
            'region'
        );

        if (!in_array($method, $allowedMethods)) {
            throw new \InvalidArgumentException(
                sprintf(
                    'Method "%s" is not valid. Allowed methods are %s',
                    $method,
                    implode(', ', $allowedMethods)
                )
            );
        }

        if (self::METHOD_GET === $method && in_array($path, $apiListMethods)){
            $url = 'https://api.iml.ru/json/';
        } elseif(self::METHOD_GET === $method && !in_array($path, $apiListMethods)){
            $url = 'https://list.iml.ru/';
        }else {
            $url = 'https://api.iml.ru/json/';
        }

        if (self::METHOD_GET === $method){
           $path .= '?' . http_build_query($parameters, '', '&');
{'fraction_non_alphanumeric': 0.15065053640721296, 'fraction_numerical': 0.0013695503309746632, 'mean_word_length': 1.8565840938722296, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 6, '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': '4532226', 'n_tokens_mistral': 1351, 'n_tokens_neox': 1317, 'n_words': 283}