<commit_before><?php

namespace petrepatrasc\BlizzardApiBundle\Service;

/**
 * Handles calling the Battle.NET service. Added for extensibility at the moment.
 * @package petrepatrasc\BlizzardApiBundle\Service
 */
class CallService
{

    /**
     * Make a call to the Battle.NET Api Service.
     *
     * @param string $region
     * @param string $apiMethod
     * @param array $params
     * @param bool $trailingSlash
     * @return string
     */
    public function makeCallToApiService($region, $apiMethod, $params = array(), $trailingSlash = true)
    {
        $urlParameters = implode('/', $params);
        $battleNetUrl = $region . $apiMethod . $urlParameters;

        if ($trailingSlash) {
            $battleNetUrl .= '/';
        }

        $result = file_get_contents($battleNetUrl);
        return $result;
    }
}<commit_msg>Fixed a bug where file_get_contents went unchallenged, and triggered an uncaught error.<commit_after><?php

namespace petrepatrasc\BlizzardApiBundle\Service;
use petrepatrasc\BlizzardApiBundle\Entity\Exception\BlizzardApiException;

/**
 * Handles calling the Battle.NET service. Added for extensibility at the moment.
 * @package petrepatrasc\BlizzardApiBundle\Service
 */
class CallService
{

    /**
     * Make a call to the Battle.NET Api Service.
     *
     * @param string $region
     * @param string $apiMethod
     * @param array $params
     * @param bool $trailingSlash
     * @throws \petrepatrasc\BlizzardApiBundle\Entity\Exception\BlizzardApiException
     * @return string
     */
    public function makeCallToApiService($region, $apiMethod, $params = array(), $trailingSlash = true)
    {
        $urlParameters = implode('/', $params);
        $battleNetUrl = $region . $apiMethod . $urlParameters;

        if ($trailingSlash) {
            $battleNetUrl .= '/';
        }

        $result = @file_get_contents($battleNetUrl);

        if ($result === FALSE) {
            throw new BlizzardApiException("Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found", 404);
        } else {
            return $result;
        }
    }
}
{'fraction_non_alphanumeric': 0.11053130929791272, 'fraction_numerical': 0.003795066413662239, 'mean_word_length': 2.7660714285714287, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '6682454', 'n_tokens_mistral': 640, 'n_tokens_neox': 618, 'n_words': 157}