<commit_before><?php
/**
 * Firal
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://firal.org/licenses/new-bsd
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to <EMAIL> so we can send you a copy immediately.
 *
 * @category   Firal
 * @package    Firal_Service
 * @subpackage Client
 * @copyright  Copyright (c) 2009-2010 Firal (http://firal.org/)
 * @license    http://firal.org/licenses/new-bsd    New BSD License
 */

/**
 * Abstract client service
 *
 * @category   Firal
 * @package    Firal_Service
 * @subpackage Client
 * @copyright  Copyright (c) 2009-2010 Firal (http://firal.org/)
 * @license    http://firal.org/licenses/new-bsd    New BSD License
 */
class Firal_Service_Client_JsonRpc implements Firal_Service_Client_ClientInterface
{

    const JSON_RPC_VERSION = '2.0';

    /**
     * The API url
     *
     * @var string
     */
    protected $_url;

    /**
     * HTTP client
     *
     * @var Zend_Http_Client
     */
    protected $_client;

    /**
     * Service map
     *
     * @var array
     */
    protected $_serviceMap;

    /**
     * Request id
     *
     * @var int
     */
    protected $_id = 0;


    /**
     * Constructor
     *
     * @param string $url
     * @param Zend_Http_Client $client
     *
     * @return void
     */
    public function __construct($url, Zend_Http_Client $client = null)
    {
        if ($url instanceof Zend_Http_Client) {
            $client = $url;
            $url    = $client->getUri();
        } elseif (null === $client) {
            $client = new Zend_Http_Client($url);
        } else {
            $client->setUri($url);
        }

        $this->_url    = $url;
        $this->_client = $client;

        $this->_serviceMap = Zend_Json::decode($client->request());
    }

    /**
     * Magic call method to call an RPC method
     *
     * @param string $name
     * @param array $arguments
     *<commit_msg>Removed the ServiceMap from the JSON-RPC client, we don't need it.<commit_after><?php
/**
 * Firal
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://firal.org/licenses/new-bsd
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to <EMAIL> so we can send you a copy immediately.
 *
 * @category   Firal
 * @package    Firal_Service
 * @subpackage Client
 * @copyright  Copyright (c) 2009-2010 Firal (http://firal.org/)
 * @license    http://firal.org/licenses/new-bsd    New BSD License
 */

/**
 * Abstract client service
 *
 * @category   Firal
 * @package    Firal_Service
 * @subpackage Client
 * @copyright  Copyright (c) 2009-2010 Firal (http://firal.org/)
 * @license    http://firal.org/licenses/new-bsd    New BSD License
 */
class Firal_Service_Client_JsonRpc implements Firal_Service_Client_ClientInterface
{

    const JSON_RPC_VERSION = '2.0';

    /**
     * The API url
     *
     * @var string
     */
    protected $_url;

    /**
     * HTTP client
     *
     * @var Zend_Http_Client
     */
    protected $_client;

    /**
     * Request id
     *
     * @var int
     */
    protected $_id = 0;


    /**
     * Constructor
     *
     * @param string $url
     * @param Zend_Http_Client $client
     *
     * @return void
     */
    public function __construct($url, Zend_Http_Client $client = null)
    {
        if ($url instanceof Zend_Http_Client) {
            $client = $url;
            $url    = $client->getUri();
        } elseif (null === $client) {
            $client = new Zend_Http_Client($url);
        } else {
            $client->setUri($url);
        }

        $this->_url    = $url;
        $this->_client = $client;
    }

    /**
     * Magic call method to call an RPC method
     *
     * @param string $name
     * @param array $arguments
     *
{'fraction_non_alphanumeric': 0.11681458383305349, 'fraction_numerical': 0.009114895658431278, 'mean_word_length': 2.1096196868008947, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, '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': '2485968', 'n_tokens_mistral': 1328, 'n_tokens_neox': 1263, 'n_words': 378}