<commit_before><?php

class CM_Janus_HttpApiClient {

    /** @var \GuzzleHttp\Client */
    protected $_httpClient;

    /**
     * @param \GuzzleHttp\Client $httpClient
     */
    public function __construct(GuzzleHttp\Client $httpClient) {
        $this->_httpClient = $httpClient;
    }

    /**
     * @param CM_Janus_Server $server
     * @param string          $clientKey
     * @return string
     * @throws CM_Exception_Invalid
     */
    public function stopStream(CM_Janus_Server $server, $clientKey) {
        return $this->_request('POST', $server, '/stopStream', ['streamId' => (string) $clientKey]);
    }

    /**
     * @param CM_Janus_Server $server
     * @return array
     * @throws CM_Exception_Invalid
     */
    public function fetchStatus(CM_Janus_Server $server) {
        $encodedStatus = $this->_request('GET', $server, '/status');
        $status = CM_Params::decode($encodedStatus, true);
        if (false == $status) {
            throw new CM_Exception_Invalid('Cannot decode server status');
        }
        return $status;
    }

    /**
     * @param string          $method
     * @param CM_Janus_Server $server
     * @param string          $path
     * @param array|null      $body
     * @return string
     * @throws CM_Exception_Invalid
     */<commit_msg>Simplify json handling in rpc endpoints<commit_after><?php

class CM_Janus_HttpApiClient {

    /** @var \GuzzleHttp\Client */
    protected $_httpClient;

    /**
     * @param \GuzzleHttp\Client $httpClient
     */
    public function __construct(GuzzleHttp\Client $httpClient) {
        $this->_httpClient = $httpClient;
    }

    /**
     * @param CM_Janus_Server $server
     * @param string          $clientKey
     * @return string
     * @throws CM_Exception_Invalid
     */
    public function stopStream(CM_Janus_Server $server, $clientKey) {
        return $this->_request('POST', $server, '/stopStream', ['streamId' => (string) $clientKey]);
    }

    /**
     * @param CM_Janus_Server $server
     * @return array
     * @throws CM_Exception_Invalid
     */
    public function fetchStatus(CM_Janus_Server $server) {
        $encodedStatus = $this->_request('GET', $server, '/status');
        return CM_Params::jsonDecode($encodedStatus);
    }

    /**
     * @param string          $method
     * @param CM_Janus_Server $server
     * @param string          $path
     * @param array|null      $body
     * @return string
     * @throws CM_Exception_Invalid
     */
{'fraction_non_alphanumeric': 0.12349155269509252, 'fraction_numerical': 0.0, 'mean_word_length': 2.4445983379501386, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '2957428', 'n_tokens_mistral': 745, 'n_tokens_neox': 727, 'n_words': 159}