<commit_before><?php

namespace WSW\SiftScience;

use WSW\SiftScience\Environments\Environment;
use WSW\SiftScience\Environments\Production;

/**
 * Class Credentials
 *
 * @package WSW\SiftScience
 * @author <NAME> <<EMAIL>>
 */
class Credentials
{
    /**
     * @var string
     */
    private $apiKey;

    /**
     * @var Environment
     */
    private $environment;

    /**
     * @param string $apiKey
     * @param Environment $environment
     */
    public function __construct($apiKey, Environment $environment = null)
    {
        $this->apiKey = substr($apiKey, 0, 16);
        $this->environment = $environment ?: new Production();
    }

    /**
     * @param string $resource
     *
     * @return string
     */
    public function getUrl($resource)
    {
        return $this->environment->getUrl($resource);
    }

    /**
     * @param string $resource
     * @param array $params
     *
     * @return string
     */
    public function getWsUrl($resource, array $params = [])
    {
        if (empty($params)) {
            return $this->environment->getWsUrl($resource);
        }

        return sprintf('%s?%s', $this->environment->getWsUrl($resource), http_build_query($params));
    }
}<commit_msg>create new method<commit_after><?php

namespace WSW\SiftScience;

use WSW\SiftScience\Environments\Environment;
use WSW\SiftScience\Environments\Production;

/**
 * Class Credentials
 *
 * @package WSW\SiftScience
 * @author <NAME> <<EMAIL>>
 */
class Credentials
{
    /**
     * @var string
     */
    private $apiKey;

    /**
     * @var Environment
     */
    private $environment;

    /**
     * @param string $apiKey
     * @param Environment $environment
     */
    public function __construct($apiKey, Environment $environment = null)
    {
        $this->apiKey = substr($apiKey, 0, 16);
        $this->environment = $environment ?: new Production();
    }

    /**
     * @param string $resource
     *
     * @return string
     */
    public function getUrl($resource)
    {
        return $this->environment->getUrl($resource);
    }

    /**
     * @param string $resource
     * @param array $params
     *
     * @return string
     */
    public function getWsUrl($resource, array $params = [])
    {
        if (empty($params)) {
            return $this->environment->getWsUrl($resource);
        }

        return sprintf('%s?%s', $this->environment->getWsUrl($resource), http_build_query($params));
    }

    /**
     * @return Environment
     */
    public function getEnvironment()
    {
        return $this->environment;
    }

    /**
     * @return string
     */
    public function getApiKey()
    {
        return $this->apiKey;
    }
}
{'fraction_non_alphanumeric': 0.14291003332099222, 'fraction_numerical': 0.0022213994816734544, 'mean_word_length': 2.2672309552599756, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 27, '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': '2715239', 'n_tokens_mistral': 845, 'n_tokens_neox': 797, 'n_words': 166}