Fixed code style.

This commit is contained in:
Jan Böhmer 2020-08-21 21:36:22 +02:00
parent 2853e471c4
commit d0b1024d80
212 changed files with 495 additions and 1005 deletions

View file

@ -103,7 +103,6 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa
*/
protected $parameters;
public function __construct()
{
parent::__construct();
@ -113,8 +112,6 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa
/**
* Check if the users of this group are enforced to have two factor authentification (2FA) enabled.
*
* @return bool
*/
public function isEnforce2FA(): bool
{
@ -124,7 +121,7 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa
/**
* Sets if the user of this group are enforced to have two factor authentification enabled.
*
* @param bool $enforce2FA True, if the users of this group are enforced to have 2FA enabled.
* @param bool $enforce2FA true, if the users of this group are enforced to have 2FA enabled
*
* @return $this
*/

View file

@ -340,7 +340,7 @@ class PermissionsEmbed
*/
public function getBitValue(string $permission_name, int $bit_n): int
{
if (! $this->isValidPermissionName($permission_name)) {
if (!$this->isValidPermissionName($permission_name)) {
throw new InvalidArgumentException(sprintf('No permission with the name "%s" is existing!', $permission_name));
}
@ -410,7 +410,7 @@ class PermissionsEmbed
*/
public function setBitValue(string $permission_name, int $bit_n, int $new_value): self
{
if (! $this->isValidPermissionName($permission_name)) {
if (!$this->isValidPermissionName($permission_name)) {
throw new InvalidArgumentException('No permission with the given name is existing!');
}
@ -429,7 +429,7 @@ class PermissionsEmbed
*/
public function getRawPermissionValue(string $permission_name): int
{
if (! $this->isValidPermissionName($permission_name)) {
if (!$this->isValidPermissionName($permission_name)) {
throw new InvalidArgumentException('No permission with the given name is existing!');
}
@ -446,7 +446,7 @@ class PermissionsEmbed
*/
public function setRawPermissionValue(string $permission_name, int $value): self
{
if (! $this->isValidPermissionName($permission_name)) {
if (!$this->isValidPermissionName($permission_name)) {
throw new InvalidArgumentException(sprintf('No permission with the given name %s is existing!', $permission_name));
}
@ -466,7 +466,7 @@ class PermissionsEmbed
*/
public function setRawPermissionValues(array $values, ?array $values2 = null): self
{
if (! empty($values2)) {
if (!empty($values2)) {
$values = array_combine($values, $values2);
}
@ -493,6 +493,7 @@ class PermissionsEmbed
}
$mask = 0b11 << $n; //Create a mask for the data
return ($data & $mask) >> $n; //Apply mask and shift back
}

View file

@ -180,8 +180,6 @@ class U2FKey implements TwoFactorKeyInterface
/**
* Gets the user, this U2F key belongs to.
*
* @return User
*/
public function getUser(): User
{
@ -190,8 +188,6 @@ class U2FKey implements TwoFactorKeyInterface
/**
* The primary key ID of this key.
*
* @return int
*/
public function getID(): int
{

View file

@ -110,7 +110,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
protected $theme = '';
/**
* @var string|null The hash of a token the user must provide when he wants to reset his password.
* @var string|null the hash of a token the user must provide when he wants to reset his password
* @ORM\Column(type="string", nullable=true)
*/
protected $pw_reset_token;
@ -261,7 +261,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
protected $permissions;
/**
* @var DateTime The time until the password reset token is valid.
* @var DateTime the time until the password reset token is valid
* @ORM\Column(type="datetime", nullable=true)
*/
protected $pw_reset_expires;
@ -367,7 +367,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Gets the currency the user prefers when showing him prices.
*
* @return Currency|null The currency the user prefers, or null if the global currency should be used.
* @return Currency|null the currency the user prefers, or null if the global currency should be used
*/
public function getCurrency(): ?Currency
{
@ -389,7 +389,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Checks if this user is disabled (user cannot login any more).
*
* @return bool True, if the user is disabled.
* @return bool true, if the user is disabled
*/
public function isDisabled(): bool
{
@ -399,7 +399,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Sets the status if a user is disabled.
*
* @param bool $disabled True if the user should be disabled.
* @param bool $disabled true if the user should be disabled
*
* @return User
*/
@ -410,7 +410,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
return $this;
}
public function getPermissions(): PermissionsEmbed
{
return $this->permissions;
@ -418,8 +417,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Check if the user needs a password change.
*
* @return bool
*/
public function isNeedPwChange(): bool
{
@ -440,8 +437,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Returns the encrypted password reset token.
*
* @return string|null
*/
public function getPwResetToken(): ?string
{
@ -462,8 +457,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Gets the datetime when the password reset token expires.
*
* @return DateTime
*/
public function getPwResetExpires(): DateTime
{
@ -498,7 +491,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
{
$tmp = $this->getFirstName();
//Dont add a space, if the name has only one part (it would look strange)
if (! empty($this->getFirstName()) && ! empty($this->getLastName())) {
if (!empty($this->getFirstName()) && !empty($this->getLastName())) {
$tmp .= ' ';
}
$tmp .= $this->getLastName();
@ -513,14 +506,14 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Change the username of this user.
*
* @param string $new_name The new username.
* @param string $new_name the new username
*
* @return $this
*/
public function setName(string $new_name): AbstractNamedDBElement
{
// Anonymous user is not allowed to change its username
if (! $this->isAnonymousUser()) {
if (!$this->isAnonymousUser()) {
$this->name = $new_name;
}
@ -529,8 +522,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Get the first name of the user.
*
* @return string|null
*/
public function getFirstName(): ?string
{
@ -553,8 +544,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Get the last name of the user.
*
* @return string|null
*/
public function getLastName(): ?string
{
@ -675,7 +664,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Gets the theme the users wants to see. See self::AVAILABLE_THEMES for valid values.
*
* @return string|null The name of the theme the user wants to see, or null if the system wide should be used.
* @return string|null the name of the theme the user wants to see, or null if the system wide should be used
*/
public function getTheme(): ?string
{
@ -723,8 +712,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Return true if the user should do two-factor authentication.
*
* @return bool
*/
public function isGoogleAuthenticatorEnabled(): bool
{
@ -733,8 +720,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Return the user name that should be shown in Google Authenticator.
*
* @return string
*/
public function getGoogleAuthenticatorUsername(): string
{
@ -744,8 +729,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Return the Google Authenticator secret
* When an empty string is returned, the Google authentication is disabled.
*
* @return string|null
*/
public function getGoogleAuthenticatorSecret(): ?string
{
@ -767,9 +750,9 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Check if the given code is a valid backup code.
*
* @param string $code The code that should be checked.
* @param string $code the code that should be checked
*
* @return bool True if the backup code is valid.
* @return bool true if the backup code is valid
*/
public function isBackupCode(string $code): bool
{
@ -822,8 +805,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Return the date when the backup codes were generated.
*
* @return DateTime|null
*/
public function getBackupCodesGenerationDate(): ?DateTime
{
@ -851,8 +832,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Check if U2F is enabled.
*
* @return bool
*/
public function isU2FAuthEnabled(): bool
{
@ -862,8 +841,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
/**
* Get all U2F Keys that are associated with this user.
*
* @return Collection
*
* @psalm-return Collection<int, TwoFactorKeyInterface>
*/
public function getU2FKeys(): Collection