mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Implemented PHP-CS-Fixer support
This commit is contained in:
@@ -5,6 +5,7 @@ use yii\base\Behavior;
|
||||
use yii\helpers\ArrayHelper;
|
||||
|
||||
class DataBehavior extends Behavior {
|
||||
|
||||
/**
|
||||
* @var string имя атрибута, к которому будет применяться поведение
|
||||
*/
|
||||
|
@@ -30,7 +30,7 @@ class EmailActivationExpirationBehavior extends Behavior {
|
||||
* @see EmailActivation::compareTime()
|
||||
* @return bool
|
||||
*/
|
||||
public function canRepeat() : bool {
|
||||
public function canRepeat(): bool {
|
||||
return $this->compareTime($this->repeatTimeout);
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ class EmailActivationExpirationBehavior extends Behavior {
|
||||
* @see EmailActivation::compareTime()
|
||||
* @return bool
|
||||
*/
|
||||
public function isExpired() : bool {
|
||||
public function isExpired(): bool {
|
||||
return $this->compareTime($this->expirationTimeout);
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ class EmailActivationExpirationBehavior extends Behavior {
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function canRepeatIn() : int {
|
||||
public function canRepeatIn(): int {
|
||||
return $this->calculateTime($this->repeatTimeout);
|
||||
}
|
||||
|
||||
@@ -62,11 +62,11 @@ class EmailActivationExpirationBehavior extends Behavior {
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function expireIn() : int {
|
||||
public function expireIn(): int {
|
||||
return $this->calculateTime($this->expirationTimeout);
|
||||
}
|
||||
|
||||
protected function compareTime(int $value) : bool {
|
||||
protected function compareTime(int $value): bool {
|
||||
if ($value < 0) {
|
||||
return false;
|
||||
}
|
||||
@@ -78,7 +78,7 @@ class EmailActivationExpirationBehavior extends Behavior {
|
||||
return time() > $this->calculateTime($value);
|
||||
}
|
||||
|
||||
protected function calculateTime(int $value) : int {
|
||||
protected function calculateTime(int $value): int {
|
||||
return $this->owner->created_at + $value;
|
||||
}
|
||||
|
||||
|
@@ -24,7 +24,7 @@ class PrimaryKeyValueBehavior extends Behavior {
|
||||
];
|
||||
}
|
||||
|
||||
public function setPrimaryKeyValue() : bool {
|
||||
public function setPrimaryKeyValue(): bool {
|
||||
if ($this->owner->getPrimaryKey() === null) {
|
||||
$this->refreshPrimaryKeyValue();
|
||||
}
|
||||
@@ -40,15 +40,15 @@ class PrimaryKeyValueBehavior extends Behavior {
|
||||
$this->owner->{$this->getPrimaryKeyName()} = $key;
|
||||
}
|
||||
|
||||
protected function generateValue() : string {
|
||||
protected function generateValue(): string {
|
||||
return (string)call_user_func($this->value);
|
||||
}
|
||||
|
||||
protected function isValueExists(string $key) : bool {
|
||||
protected function isValueExists(string $key): bool {
|
||||
return $this->owner->find()->andWhere([$this->getPrimaryKeyName() => $key])->exists();
|
||||
}
|
||||
|
||||
protected function getPrimaryKeyName() : string {
|
||||
protected function getPrimaryKeyName(): string {
|
||||
$owner = $this->owner;
|
||||
$primaryKeys = $owner->primaryKey();
|
||||
if (!isset($primaryKeys[0])) {
|
||||
|
Reference in New Issue
Block a user