mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Translate all code comments from Russian to English [skip ci]
This commit is contained in:
@@ -7,7 +7,7 @@ use yii\helpers\ArrayHelper;
|
||||
class DataBehavior extends Behavior {
|
||||
|
||||
/**
|
||||
* @var string имя атрибута, к которому будет применяться поведение
|
||||
* @var string attribute name to which this behavior will be applied
|
||||
*/
|
||||
public $attribute = '_data';
|
||||
|
||||
@@ -31,8 +31,8 @@ class DataBehavior extends Behavior {
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @throws \yii\base\ErrorException Yii2 подхватит Notice от неправильной десериализаци и превратит его
|
||||
* в свой Exception, благодаря чему программа сможем продолжить нормально работать (вернее ловить Exception)
|
||||
* @throws \yii\base\ErrorException Yii2 will catch Notice from the wrong deserialization and turn it
|
||||
* into its own Exception, so that the program can continue to work normally (you still should catch an Exception)
|
||||
*/
|
||||
private function getData() {
|
||||
$data = $this->owner->{$this->attribute};
|
||||
|
@@ -9,23 +9,23 @@ use yii\base\Behavior;
|
||||
class EmailActivationExpirationBehavior extends Behavior {
|
||||
|
||||
/**
|
||||
* @var int количество секунд, прежде чем можно будет повторить отправку кода
|
||||
* @var int the number of seconds before the code can be sent again
|
||||
* @see EmailActivation::canRepeat()
|
||||
*/
|
||||
public $repeatTimeout;
|
||||
|
||||
/**
|
||||
* @var int количество секунд, прежде чем это подтверждение истечёт
|
||||
* @var int the number of seconds before this activation expires
|
||||
* @see EmailActivation::isExpired()
|
||||
*/
|
||||
public $expirationTimeout;
|
||||
|
||||
/**
|
||||
* Можно ли повторить отправку письма текущего типа?
|
||||
* Для проверки используется значение EmailActivation::$repeatTimeout и интерпретируется как:
|
||||
* - <0 запретит повторную отправку этого кода
|
||||
* - =0 позволит отправлять сообщения в любой момент
|
||||
* - >0 будет проверять, сколько секунд прошло с момента создания модели
|
||||
* Is it allowed to resend a message of the current type?
|
||||
* The value of EmailActivation::$repeatTimeout is used for checking as follows:
|
||||
* - <0 will forbid you to resend this activation
|
||||
* - =0 allows you to send messages at any time
|
||||
* - >0 will check how many seconds have passed since the model was created
|
||||
*
|
||||
* @see EmailActivation::compareTime()
|
||||
* @return bool
|
||||
@@ -35,11 +35,11 @@ class EmailActivationExpirationBehavior extends Behavior {
|
||||
}
|
||||
|
||||
/**
|
||||
* Истёк ли срок кода?
|
||||
* Для проверки используется значение EmailActivation::$expirationTimeout и интерпретируется как:
|
||||
* - <0 означает, что код никогда не истечёт
|
||||
* - =0 всегда будет говорить, что код истёк
|
||||
* - >0 будет проверять, сколько секунд прошло с момента создания модели
|
||||
* Did the code expire?
|
||||
* The value of EmailActivation::$expirationTimeout is used for checking as follows:
|
||||
* - <0 means the code will never expire
|
||||
* - =0 will always say that the code has expired
|
||||
* - >0 will check how many seconds have passed since the model was created
|
||||
*
|
||||
* @see EmailActivation::compareTime()
|
||||
* @return bool
|
||||
@@ -48,25 +48,15 @@ class EmailActivationExpirationBehavior extends Behavior {
|
||||
return $this->compareTime($this->expirationTimeout);
|
||||
}
|
||||
|
||||
/**
|
||||
* Вычисляет, во сколько можно будет выполнить повторную отправку кода
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function canRepeatIn(): int {
|
||||
return $this->calculateTime($this->repeatTimeout);
|
||||
}
|
||||
|
||||
/**
|
||||
* Вычисляет, во сколько код истечёт
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function expireIn(): int {
|
||||
return $this->calculateTime($this->expirationTimeout);
|
||||
}
|
||||
|
||||
protected function compareTime(int $value): bool {
|
||||
private function compareTime(int $value): bool {
|
||||
if ($value < 0) {
|
||||
return false;
|
||||
}
|
||||
@@ -78,7 +68,7 @@ class EmailActivationExpirationBehavior extends Behavior {
|
||||
return time() > $this->calculateTime($value);
|
||||
}
|
||||
|
||||
protected function calculateTime(int $value): int {
|
||||
private function calculateTime(int $value): int {
|
||||
return $this->owner->created_at + $value;
|
||||
}
|
||||
|
||||
|
@@ -11,10 +11,11 @@ use yii\db\ActiveRecord;
|
||||
class PrimaryKeyValueBehavior extends Behavior {
|
||||
|
||||
/**
|
||||
* @var callable Функция, что будет вызвана для генерации ключа.
|
||||
* Должна возвращать случайное значение, подходящее для логики модели. Функция будет вызываться
|
||||
* в цикле do-while с целью избежания дубликатов строк по первичному ключу, так что если функция
|
||||
* станет возвращать статичное значение, то программа зациклится и что-нибудь здохнет. Не делайте так.
|
||||
* @var callable The function that will be called to generate the key.
|
||||
* Must return a random value suitable for model logic.
|
||||
* The function will be called in the do-while loop to avoid duplicate strings by the primary key,
|
||||
* so if the function returns a static value, the program will loop forever and something will die.
|
||||
* Don't do so.
|
||||
*/
|
||||
public $value;
|
||||
|
||||
@@ -60,7 +61,6 @@ class PrimaryKeyValueBehavior extends Behavior {
|
||||
throw new InvalidConfigException('Current behavior don\'t support models with more then one primary key.');
|
||||
}
|
||||
|
||||
/** @noinspection PhpIncompatibleReturnTypeInspection да как бы оно всё нормально, но шторм мне не верит */
|
||||
return $primaryKeys[0];
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user