<commit_before><?php

namespace EWZ\RecaptchaBundle\Form;

use Symfony\Component\Form\Field;
use Symfony\Component\Form\Exception\FormException;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 * A field for entering a recaptcha text.
 */
class RecaptchaField extends Field
{
    /**
     * The reCAPTCHA server URL's
     */
    const RECAPTCHA_API_SERVER        = 'http://www.google.com/recaptcha/api';
    const RECAPTCHA_API_SECURE_SERVER = 'https://www.google.com/recaptcha/api';
    const RECAPTCHA_API_JS_SERVER     = 'http://www.google.com/recaptcha/api/js/recaptcha_ajax.js';

    /**
     * The javascript src attributes (challenge, noscript)
     *
     * @var string
     */
    protected $scrips;

    /**
     * The public key
     *
     * @var string
     */
    protected $pubkey;

    /**
     * The security token
     *
     * @var string
     */
    protected $secure;

    /**
     * Sets the Javascript source URLs.
     *
     * @param ContainerInterface $container An ContainerInterface instance
     */
    public function setScriptURLs($publicKey, $isSecure))
    {
        $this->pubkey = $publicKey;
        $this->secure = $isSecure;

        if ($this->pubkey == null || $this->pubkey == '') {
            throw new FormException('To use reCAPTCHA you must get an API key from <a href="https://www.google.com/recaptcha/admin/create">https://www.google.com/recaptcha/admin/create</a>');
        }


        if ($this->secure) {
            $server = self::RECAPTCHA_API_SECURE_SERVER;
        } else {
            $server = self::RECAPTCHA_API_SERVER;
        }

        $this->scrips = array(
            'challenge' => $server.'/challenge?k='.$this->pubkey,
            'noscript'  => $server.'/noscript?k='.$this->pubkey,
        );
    }

    /**
     * Gets the Javascript source URLs.
     *
     * @param string $key The script name
     *
     * @return string The javascript source URL
     */
    public function getScriptURL($key)
    {
        return isset($this->scrips[$key]) ? $this->scrips[$key] : null;
    }

    /**
     * Gets the public key.
     *
     * @return string The javascript source URL
     */
    public function getPublicKey()
    {
        return $this->pubkey;
    }
}
<commit_msg>Fixed typos<commit_after><?php

namespace EWZ\RecaptchaBundle\Form;

use Symfony\Component\Form\Field;
use Symfony\Component\Form\Exception\FormException;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 * A field for entering a recaptcha text.
 */
class RecaptchaField extends Field
{
    /**
     * The reCAPTCHA server URL's
     */
    const RECAPTCHA_API_SERVER        = 'http://www.google.com/recaptcha/api';
    const RECAPTCHA_API_SECURE_SERVER = 'https://www.google.com/recaptcha/api';
    const RECAPTCHA_API_JS_SERVER     = 'http://www.google.com/recaptcha/api/js/recaptcha_ajax.js';

    /**
     * The javascript src attributes (challenge, noscript)
     *
     * @var string
     */
    protected $scripts;

    /**
     * The public key
     *
     * @var string
     */
    protected $pubkey;

    /**
     * The security token
     *
     * @var string
     */
    protected $secure;

    /**
     * Sets the Javascript source URLs.
     *
     * @param ContainerInterface $container An ContainerInterface instance
     */
    public function setScriptURLs($publicKey, $isSecure)
    {
        $this->pubkey = $publicKey;
        $this->secure = $isSecure;

        if ($this->pubkey == null || $this->pubkey == '') {
            throw new FormException('To use reCAPTCHA you must get an API key from <a href="https://www.google.com/recaptcha/admin/create">https://www.google.com/recaptcha/admin/create</a>');
        }


        if ($this->secure) {
            $server = self::RECAPTCHA_API_SECURE_SERVER;
        } else {
            $server = self::RECAPTCHA_API_SERVER;
        }

        $this->scripts = array(
            'challenge' => $server.'/challenge?k='.$this->pubkey,
            'noscript'  => $server.'/noscript?k='.$this->pubkey,
        );
    }

    /**
     * Gets the Javascript source URLs.
     *
     * @param string $key The script name
     *
     * @return string The javascript source URL
     */
    public function getScriptURL($key)
    {
        return isset($this->scripts[$key]) ? $this->scripts[$key] : null;
    }

    /**
     * Gets the public key.
     *
     * @return string The javascript source URL
     */
    public function getPublicKey()
    {
        return $this->pubkey;
    }
}

{'fraction_non_alphanumeric': 0.1317008603573792, 'fraction_numerical': 0.0, 'mean_word_length': 2.2201704545454546, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 33, 'https://': 6, 'lorem ipsum': 0, 'www.': 10, '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': '2062578', 'n_tokens_mistral': 1465, 'n_tokens_neox': 1396, 'n_words': 293}