Skip to content
Snippets Groups Projects
Commit c5133343 authored by Anton Ivanov's avatar Anton Ivanov
Browse files

Issue #3373058 by sidharth_soman, tvalimaa, silvi.addweb, clarkssquared: Fix...

Issue #3373058 by sidharth_soman, tvalimaa, silvi.addweb, clarkssquared: Fix the errors/warnings reported by Php_CodeSniffer
parent b5ca0b64
Branches
Tags
No related merge requests found
......@@ -91,7 +91,7 @@ class UserEmailVerificationVerify extends ControllerBase implements ContainerInj
$verification = $this->userEmailVerification->loadVerificationByUserId($uid);
// User tries to use verification link that doesn't belong to him
// User tries to use verification link that doesn't belong to user
// or link was created for user which doesn't exist.
if (($this->currentUser()->isAuthenticated() && $this->currentUser()->id() != $uid) || !$verification) {
$this->messenger()->addError($this->t('Your verification link is incorrect. Request a new one using the form below.'));
......
......@@ -90,7 +90,7 @@ class UserEmailVerificationVerifyExtended extends ControllerBase implements Cont
$verification = $this->userEmailVerification->loadVerificationByUserId($uid);
// User tries to use verification link that doesn't belong to him
// User tries to use verification link that doesn't belong to user
// or link was created for user which doesn't exist.
if (($this->currentUser()->isAuthenticated() && $this->currentUser()->id() != $uid) || !$verification) {
$this->messenger()->addError($this->t('Your verification link is incorrect. Request a new one using the form below.'));
......
......@@ -2,8 +2,8 @@
namespace Drupal\user_email_verification\Event;
use Symfony\Contracts\EventDispatcher\Event;
use Drupal\user\UserInterface;
use Symfony\Contracts\EventDispatcher\Event;
/**
* Wraps a user account block event for event subscribers.
......@@ -13,7 +13,7 @@ use Drupal\user\UserInterface;
class UserEmailVerificationBlockAccountEvent extends Event {
/**
* The user account being verify.
* The user account being verified.
*
* @var \Drupal\user\UserInterface
*/
......@@ -30,7 +30,7 @@ class UserEmailVerificationBlockAccountEvent extends Event {
* Constructs a user email verification event object.
*
* @param \Drupal\user\UserInterface $user
* The user account being verify.
* The user account being verified.
* @param bool $should_be_blocked
* Should the user account be blocked or no.
*/
......@@ -40,7 +40,7 @@ class UserEmailVerificationBlockAccountEvent extends Event {
}
/**
* Get the user account being verify.
* Get the user account being verified.
*
* @return \Drupal\user\UserInterface
* The user account.
......
......@@ -2,8 +2,8 @@
namespace Drupal\user_email_verification\Event;
use Symfony\Contracts\EventDispatcher\Event;
use Drupal\user\UserInterface;
use Symfony\Contracts\EventDispatcher\Event;
/**
* Wraps a user email verification creation event for event subscribers.
......@@ -13,7 +13,7 @@ use Drupal\user\UserInterface;
class UserEmailVerificationCreateVerificationEvent extends Event {
/**
* The user account being verify.
* The user account being verified.
*
* @var \Drupal\user\UserInterface
*/
......@@ -30,7 +30,7 @@ class UserEmailVerificationCreateVerificationEvent extends Event {
* Constructs a user email verification event object.
*
* @param \Drupal\user\UserInterface $user
* The user account being verify.
* The user account being verified.
* @param bool $should_be_verified
* Should be user account verified by default or no.
*/
......@@ -40,7 +40,7 @@ class UserEmailVerificationCreateVerificationEvent extends Event {
}
/**
* Get the user account being verify.
* Get the user account being verified.
*
* @return \Drupal\user\UserInterface
* The user account.
......
......@@ -2,8 +2,8 @@
namespace Drupal\user_email_verification\Event;
use Symfony\Contracts\EventDispatcher\Event;
use Drupal\user\UserInterface;
use Symfony\Contracts\EventDispatcher\Event;
/**
* Wraps a user account delete event for event subscribers.
......@@ -13,7 +13,7 @@ use Drupal\user\UserInterface;
class UserEmailVerificationDeleteAccountEvent extends Event {
/**
* The user account being verify.
* The user account being verified.
*
* @var \Drupal\user\UserInterface
*/
......@@ -30,7 +30,7 @@ class UserEmailVerificationDeleteAccountEvent extends Event {
* Constructs a user email verification event object.
*
* @param \Drupal\user\UserInterface $user
* The user account being verify.
* The user account being verified.
* @param bool $should_be_deleted
* Should the user account be deleted or no.
*/
......@@ -40,7 +40,7 @@ class UserEmailVerificationDeleteAccountEvent extends Event {
}
/**
* Get the user account being verify.
* Get the user account being verified.
*
* @return \Drupal\user\UserInterface
* The user account.
......
......@@ -2,8 +2,8 @@
namespace Drupal\user_email_verification\Event;
use Symfony\Contracts\EventDispatcher\Event;
use Drupal\user\UserInterface;
use Symfony\Contracts\EventDispatcher\Event;
/**
* Wraps a user email verification event for event subscribers.
......@@ -13,7 +13,7 @@ use Drupal\user\UserInterface;
class UserEmailVerificationVerifyEvent extends Event {
/**
* The user account being verify.
* The user account being verified.
*
* @var \Drupal\user\UserInterface
*/
......@@ -30,7 +30,7 @@ class UserEmailVerificationVerifyEvent extends Event {
* Constructs a user email verification event object.
*
* @param \Drupal\user\UserInterface $user
* The user account being verify.
* The user account being verified.
* @param bool $notify_as_blocked
* Whether to notify the user as blocked account.
*/
......@@ -40,7 +40,7 @@ class UserEmailVerificationVerifyEvent extends Event {
}
/**
* Get the user account being verify.
* Get the user account being verified.
*
* @return \Drupal\user\UserInterface
* The user account.
......
......@@ -13,7 +13,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\RequestStack;
/**
* Class UserEmailVerificationRequestForm.
* Class for defining UserEmailVerification Request Form.
*/
class UserEmailVerificationRequestForm extends FormBase {
......
......@@ -5,8 +5,8 @@ namespace Drupal\user_email_verification\Plugin\views\filter;
use Drupal\Core\Database\Query\Condition;
use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
use Drupal\views\ViewExecutable;
use Drupal\views\Plugin\views\filter\FilterPluginBase;
use Drupal\views\ViewExecutable;
/**
* Simple filter to handle matching of boolean values.
......@@ -36,7 +36,7 @@ class EmailVerification extends FilterPluginBase {
const EQUAL = '=';
/**
* The non equal query operator.
* The non-equal query operator.
*
* @var string
*/
......@@ -54,14 +54,14 @@ class EmailVerification extends FilterPluginBase {
*
* @var bool
*/
public $no_operator = TRUE;
public $noOperator = TRUE;
/**
* Whether to accept NULL as a false value or not.
*
* @var bool
*/
public $accept_null = FALSE;
public $acceptNull = FALSE;
/**
* {@inheritdoc}
......@@ -117,10 +117,10 @@ class EmailVerification extends FilterPluginBase {
}
if (isset($this->definition['accept null'])) {
$this->accept_null = (bool) $this->definition['accept null'];
$this->acceptNull = (bool) $this->definition['accept null'];
}
elseif (isset($this->definition['accept_null'])) {
$this->accept_null = (bool) $this->definition['accept_null'];
elseif (isset($this->definition['acceptNull'])) {
$this->acceptNull = (bool) $this->definition['acceptNull'];
}
$this->valueOptions = NULL;
}
......@@ -140,19 +140,31 @@ class EmailVerification extends FilterPluginBase {
public function getValueOptions() {
if (isset($this->definition['type'])) {
if ($this->definition['type'] == 'yes-no') {
$this->valueOptions = [1 => $this->t('Yes'), 0 => $this->t('No')];
$this->valueOptions = [
1 => $this->t('Yes'),
0 => $this->t('No'),
];
}
if ($this->definition['type'] == 'on-off') {
$this->valueOptions = [1 => $this->t('On'), 0 => $this->t('Off')];
$this->valueOptions = [
1 => $this->t('On'),
0 => $this->t('Off'),
];
}
if ($this->definition['type'] == 'enabled-disabled') {
$this->valueOptions = [1 => $this->t('Enabled'), 0 => $this->t('Disabled')];
$this->valueOptions = [
1 => $this->t('Enabled'),
0 => $this->t('Disabled'),
];
}
}
// Provide a fallback if the above didn't set anything.
if (!isset($this->valueOptions)) {
$this->valueOptions = [1 => $this->t('True'), 0 => $this->t('False')];
$this->valueOptions = [
1 => $this->t('True'),
0 => $this->t('False'),
];
}
}
......@@ -269,7 +281,7 @@ class EmailVerification extends FilterPluginBase {
*/
protected function queryOpBoolean($field, $query_operator = self::EQUAL) {
if (empty($this->value)) {
if ($this->accept_null) {
if ($this->acceptNull) {
if ($query_operator === self::EQUAL) {
$condition = (new Condition('OR'))
->condition($field, 0, $query_operator)
......
......@@ -16,10 +16,10 @@ use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\Url;
use Drupal\Core\Utility\Token;
use Drupal\user\UserInterface;
use Drupal\user_email_verification\Event\UserEmailVerificationEvents;
use Drupal\user_email_verification\Event\UserEmailVerificationBlockAccountEvent;
use Drupal\user_email_verification\Event\UserEmailVerificationCreateVerificationEvent;
use Drupal\user_email_verification\Event\UserEmailVerificationDeleteAccountEvent;
use Drupal\user_email_verification\Event\UserEmailVerificationEvents;
use Drupal\user_email_verification\Event\UserEmailVerificationRulesExtendedReminderMailSent;
use Drupal\user_email_verification\Event\UserEmailVerificationRulesReminderMailSent;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
......@@ -387,8 +387,8 @@ class UserEmailVerification implements UserEmailVerificationInterface {
'last_reminder' => $this->time->getRequestTime(),
'reminders' => 0,
'state' => $verified
? UserEmailVerificationInterface::STATE_APPROVED
: UserEmailVerificationInterface::STATE_IN_PROGRESS,
? UserEmailVerificationInterface::STATE_APPROVED
: UserEmailVerificationInterface::STATE_IN_PROGRESS,
])
->execute();
}
......@@ -667,8 +667,13 @@ class UserEmailVerification implements UserEmailVerificationInterface {
$original_language = $this->languageManager->getConfigOverrideLanguage();
$this->languageManager->setConfigOverrideLanguage($language);
$token_data = ['user' => $user];
$token_options = ['langcode' => $user->getPreferredLangcode(), 'clear' => TRUE];
$token_data = [
'user' => $user,
];
$token_options = [
'langcode' => $user->getPreferredLangcode(),
'clear' => TRUE,
];
switch ($key) {
......
......@@ -12,7 +12,7 @@ use Drupal\user_email_verification\UserEmailVerificationInterface;
* Implements hook_install().
*/
function user_email_verification_install() {
// TODO: ReDo it with batch (if many users - timeout on install).
// @todo ReDo it with batch (if many users - timeout on install).
$database = \Drupal::database();
$uids = $database->select('users', 'u')
......
......@@ -5,8 +5,8 @@
* User email verification hooks and alters.
*/
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\user\UserInterface;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment