Commit 746636da authored by chishah92's avatar chishah92 Committed by elachlan

Issue #2887225 by arunkumark, jayesh_makwana, chishah92, Sivaprasad C: Coding Standard issues

parent 6aa25be3
......@@ -107,10 +107,10 @@ function foo_captcha_help($route_name, RouteMatchInterface $route_match) {
* modules. More advanced CAPTCHA modules can also use extra provided arguments
* $element and $form_state:
*
* @param $solution
* the solution for the challenge as reported by hook_captcha('generate',...).
* @param $response
* the answer given by the user.
* @param string $solution
* The solution for the challenge as reported by hook_captcha('generate',...).
* @param string $response
* The answer given by the user.
*
* @return true
* on success and FALSE on failure.
......@@ -126,19 +126,19 @@ function foo_captcha_custom_validation($solution, $response) {
* validation function of the #captcha element. See captcha_validate() in
* captcha.module for more info about this.
*
* @param $solution
* the solution for the challenge as reported by hook_captcha('generate',...).
* @param $response
* the answer given by the user.
* @param $element
* element argument.
* @param $form_state
* form_state argument.
* @param string $solution
* The solution for the challenge as reported by hook_captcha('generate',...).
* @param string $response
* The answer given by the user.
* @param array $element
* The element argument.
* @param array $form_state
* The form_state argument.
*
* @return true
* on success and FALSE on failure.
*/
function foo_captcha_custom_advance_validation($solution, $response, $element, $form_state) {
function foo_captcha_custom_advance_validation($solution, $response, array $element, array $form_state) {
return $form_state['foo']['#bar'] = 'baz';
}
......
......@@ -336,7 +336,7 @@ class ImageCaptchaSettingsForm extends ConfigFormBase {
// Put these fonts with preview image in the list.
foreach ($fonts as $token => $font) {
$title = t('Font preview of @font (@file)', [
$title = $this->t('Font preview of @font (@file)', [
'@font' => $font['name'],
'@file' => $font['uri'],
]);
......@@ -350,14 +350,14 @@ class ImageCaptchaSettingsForm extends ConfigFormBase {
}
// Append the PHP built-in font at the end.
$title = t('Preview of built-in font');
$title = $this->t('Preview of built-in font');
$attributes = [
'src' => Url::fromRoute('image_captcha.font_preview', ['token' => 'BUILTIN'])
->toString(),
'alt' => $title,
'title' => $title,
];
$available_fonts['BUILTIN'] = (string) t('PHP built-in font: font_preview', [
$available_fonts['BUILTIN'] = (string) $this->t('PHP built-in font: font_preview', [
'font_preview' => '<img' . new Attribute($attributes) . ' />',
]);
......
......@@ -16,6 +16,8 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
class Captcha extends FormElement implements ContainerFactoryPluginInterface {
/**
* The config factory.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected $configFactory;
......@@ -130,10 +132,9 @@ class Captcha extends FormElement implements ContainerFactoryPluginInterface {
// Additional one time CAPTCHA token: store in database and send with form.
// $captcha_token = hash('sha256', mt_rand());
// db_update('captcha_sessions')
// ->fields(['token' => $captcha_token])
// ->condition('csid', $captcha_sid)
// ->execute();
// ->fields(['token' => $captcha_token])
// ->condition('csid', $captcha_sid)
// ->execute();
$captcha_token = \Drupal::database()
->select('captcha_sessions', 'cs')
->fields('cs', ['token'])
......
......@@ -13,6 +13,8 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class CaptchaCachedSettingsSubscriber implements EventSubscriberInterface {
/**
* The Element info.
*
* @var \Drupal\Core\Render\ElementInfoManagerInterface
*/
protected $elementInfo;
......@@ -21,6 +23,7 @@ class CaptchaCachedSettingsSubscriber implements EventSubscriberInterface {
* CaptchaCachedSettingsSubscriber constructor.
*
* @param \Drupal\Core\Render\ElementInfoManagerInterface $elementInfo
* Constructor.
*/
public function __construct(ElementInfoManagerInterface $elementInfo) {
$this->elementInfo = $elementInfo;
......
......@@ -15,7 +15,9 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
class CaptchaExamplesForm extends FormBase {
/**
* @var \Drupal\Core\Extension\ModuleHandlerInterface $moduleHandler
* The module handler.
*
* @var \Drupal\Core\Extension\ModuleHandlerInterface
*/
protected $moduleHandler;
......@@ -23,6 +25,7 @@ class CaptchaExamplesForm extends FormBase {
* CaptchaExamplesForm constructor.
*
* @param \Drupal\Core\Extension\ModuleHandlerInterface $moduleHandler
* Constructor.
*/
public function __construct(ModuleHandlerInterface $moduleHandler) {
$this->moduleHandler = $moduleHandler;
......
......@@ -13,6 +13,8 @@ use Symfony\Component\HttpFoundation\RequestStack;
class CaptchaPointForm extends EntityForm {
/**
* The request stack.
*
* @var \Symfony\Component\HttpFoundation\RequestStack
*/
protected $requestStack;
......@@ -21,13 +23,17 @@ class CaptchaPointForm extends EntityForm {
* CaptchaPointForm constructor.
*
* @param \Symfony\Component\HttpFoundation\RequestStack $request_stack
* Constructor.
*/
public function __construct(RequestStack $request_stack) {
$this->requestStack = $request_stack;
}
/**
* Create Captcha Points.
*
* @param \Symfony\Component\DependencyInjection\ContainerInterface $container
* Event to create Captcha points.
*
* @return static
*/
......
......@@ -23,7 +23,9 @@ class CaptchaSettingsForm extends ConfigFormBase {
protected $cacheBackend;
/**
* @var \Drupal\Core\Extension\ModuleHandlerInterface $moduleHandler
* The module handler.
*
* @var \Drupal\Core\Extension\ModuleHandlerInterface
*/
protected $moduleHandler;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment