Skip to content

Commit

Permalink
Fix code style
Browse files Browse the repository at this point in the history
  • Loading branch information
moesoha committed Mar 25, 2018
1 parent 0fe1176 commit 96f6391
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
14 changes: 7 additions & 7 deletions src/Form/Type/EWZRecaptchaType.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ class EWZRecaptchaType extends AbstractType
*
* @var string
*/
protected $RECAPTCHA_API_SERVER;
protected $recaptchaApiServer;

/**
* The reCAPTCHA JS server URL.
*
* @var string
*/
protected $RECAPTCHA_API_JS_SERVER;
protected $recaptchaApiJsServer;

/**
* The public key.
Expand Down Expand Up @@ -67,15 +67,15 @@ class EWZRecaptchaType extends AbstractType
* @param bool $ajax Ajax status
* @param LocaleResolver $localeResolver
*/
public function __construct($publicKey, $enabled, $ajax, LocaleResolver $localeResolver, $apiHost='www.google.com')
public function __construct($publicKey, $enabled, $ajax, LocaleResolver $localeResolver, $apiHost = 'www.google.com')
{
$this->publicKey = $publicKey;
$this->enabled = $enabled;
$this->ajax = $ajax;
$this->apiHost = $apiHost;
$this->localeResolver = $localeResolver;
$this->RECAPTCHA_API_JS_SERVER = '//'.$apiHost.'/recaptcha/api/js/recaptcha_ajax.js';
$this->RECAPTCHA_API_SERVER = 'https://'.$apiHost.'/recaptcha/api.js';
$this->recaptchaApiJsServer = sprintf('//%s/recaptcha/api/js/recaptcha_ajax.js', $apiHost);
$this->recaptchaApiServer = sprintf('https://%s/recaptcha/api.js', $apiHost);
}

/**
Expand All @@ -99,12 +99,12 @@ public function buildView(FormView $view, FormInterface $form, array $options)

if (!$this->ajax) {
$view->vars = array_replace($view->vars, array(
'url_challenge' => sprintf('%s?hl=%s', $this->RECAPTCHA_API_SERVER, $options['language']),
'url_challenge' => sprintf('%s?hl=%s', $this->recaptchaApiServer, $options['language']),
'public_key' => $this->publicKey,
));
} else {
$view->vars = array_replace($view->vars, array(
'url_api' => $this->RECAPTCHA_API_JS_SERVER,
'url_api' => $this->recaptchaApiJsServer,
'public_key' => $this->publicKey,
));
}
Expand Down
8 changes: 4 additions & 4 deletions src/Validator/Constraints/IsTrueValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class IsTrueValidator extends ConstraintValidator
*
* @var string
*/
protected $RECAPTCHA_VERIFY_SERVER;
protected $recaptchaVerifyServer;

/**
* @param bool $enabled
Expand All @@ -83,7 +83,7 @@ public function __construct(
$verifyHost,
AuthorizationCheckerInterface $authorizationChecker = null,
array $trusted_roles = array(),
$apiHost='www.google.com')
$apiHost = 'www.google.com')
{
$this->enabled = $enabled;
$this->privateKey = $privateKey;
Expand All @@ -92,7 +92,7 @@ public function __construct(
$this->verifyHost = $verifyHost;
$this->authorizationChecker = $authorizationChecker;
$this->trusted_roles = $trusted_roles;
$this->RECAPTCHA_VERIFY_SERVER = 'https://'.$apiHost;
$this->recaptchaVerifyServer = 'https://'.$apiHost;
}

/**
Expand Down Expand Up @@ -149,7 +149,7 @@ private function checkAnswer($privateKey, $remoteip, $answer)
return false;
}

$response = $this->httpGet($this->RECAPTCHA_VERIFY_SERVER, '/recaptcha/api/siteverify', array(
$response = $this->httpGet($this->recaptchaVerifyServer, '/recaptcha/api/siteverify', array(
'secret' => $privateKey,
'remoteip' => $remoteip,
'response' => $answer,
Expand Down

0 comments on commit 96f6391

Please sign in to comment.