<commit_before><?php
/**
 * Mondido
 *
 * PHP version 5.6
 *
 * @category Mondido
 * @package  Mondido_Mondido
 * @author   <NAME> <<EMAIL>>
 * @license  MIT License https://opensource.org/licenses/MIT
 * @link     https://www.mondido.com
 */

namespace Mondido\Mondido\Model\Api;

/**
 * Abstract Mondido API model
 *
 * @category Mondido
 * @package  Mondido_Mondido
 * @author   <NAME> <<EMAIL>>
 * @license  MIT License https://opensource.org/licenses/MIT
 * @link     https://www.mondido.com
 */
abstract class Mondido
{
    protected $_adapter;

    /**
     * Call
     *
     * @param string $method   HTTP method
     * @param string $resource API resource
     * @param mixed  $params   URL params
     * @param array  $data     Data to send to the API
     *
     * @return string
     */
    public function call($method, $resource, $params = null, $data = [])
    {
        $url = 'https://api.mondido.com/v1/' . $resource;

        if (is_string($params)) {
            $url .= "/$value";
        } else if (is_array($params)) {
            foreach ($params as $key => $value) {
                if (is_numeric($key)) {
                    $url .= "/$value";
                } else {
                    $url .= "/$key/$value";
                }
            }
        }

        if (sizeof($data)) {
            if ($method == 'GET') {
                $url .= '?' . http_build_query($data);
            } else {
                $this->_adapter->addOption(CURLOPT_POSTFIELDS, $data);
            }
        }

        switch ($method) {
            case 'POST':
                $this->_adapter->addOption(CURLOPT_POST, true);
                break;
            case 'GET':
                $this->_adapter->addOption(CURLOPT_POST, false);
                break;
            case 'DELETE':
                $this->_adapter->addOption(CURLOPT_POST, false)
                    ->addOption(CURLOPT_CUSTOMREQUEST, 'DELETE');<commit_msg>Pass a string instead of array<commit_after><?php
/**
 * Mondido
 *
 * PHP version 5.6
 *
 * @category Mondido
 * @package  Mondido_Mondido
 * @author   <NAME> <<EMAIL>>
 * @license  MIT License https://opensource.org/licenses/MIT
 * @link     https://www.mondido.com
 */

namespace Mondido\Mondido\Model\Api;

/**
 * Abstract Mondido API model
 *
 * @category Mondido
 * @package  Mondido_Mondido
 * @author   <NAME> <<EMAIL>>
 * @license  MIT License https://opensource.org/licenses/MIT
 * @link     https://www.mondido.com
 */
abstract class Mondido
{
    protected $_adapter;

    /**
     * Call
     *
     * @param string $method   HTTP method
     * @param string $resource API resource
     * @param mixed  $params   URL params
     * @param array  $data     Data to send to the API
     *
     * @return string
     */
    public function call($method, $resource, $params = null, $data = [])
    {
        $url = 'https://api.mondido.com/v1/' . $resource;

        if (is_string($params)) {
            $url .= "/$value";
        } else if (is_array($params)) {
            foreach ($params as $key => $value) {
                if (is_numeric($key)) {
                    $url .= "/$value";
                } else {
                    $url .= "/$key/$value";
                }
            }
        }

        if (sizeof($data)) {
            if ($method == 'GET') {
                $url .= '?' . http_build_query($data);
            } else {
                $this->_adapter->addOption(CURLOPT_POSTFIELDS, http_build_query($data));
            }
        }

        switch ($method) {
            case 'POST':
                $this->_adapter->addOption(CURLOPT_POST, true);
                break;
            case 'GET':
                $this->_adapter->addOption(CURLOPT_POST, false);
                break;
            case 'DELETE':
                $this->_adapter->addOption(CURLOPT_POST, false)
                    ->addOption(CURLOPT_CUSTOMREQUEST, 'DELETE');
{'fraction_non_alphanumeric': 0.14303959131545338, 'fraction_numerical': 0.0015325670498084292, 'mean_word_length': 1.6531165311653115, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 35, 'https://': 10, 'lorem ipsum': 0, 'www.': 4, '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': '75060', 'n_tokens_mistral': 1183, 'n_tokens_neox': 1152, 'n_words': 256}