Skip to content
Permalink
Browse files

Codacy suggestions

  • Loading branch information...
Thoulah committed Mar 3, 2019
1 parent 8e91b18 commit b93c63b892491c16952d35ca35d678f135bd1255
@@ -33,7 +33,7 @@ public function actionAlbumImage(): void {
foreach ($artist->albums as $album) :
Console::updateProgress(++$x, $count);
[$width, $height, $type] = ($album->image) ? getimagesizefromstring($album->image) : [0, 0, 0];
if ($width === self::ALBUM_IMAGE_DIMENSIONS && $height === self::ALBUM_IMAGE_DIMENSIONS && $type === IMAGETYPE_JPEG && !is_null($album->image_color))
if ($width === self::ALBUM_IMAGE_DIMENSIONS && $height === self::ALBUM_IMAGE_DIMENSIONS && $type === IMAGETYPE_JPEG && $album->image_color !== null)
continue;
Console::write($artist->name, [Console::FG_PURPLE], 3);
@@ -97,7 +97,7 @@ public function actionCreate(): string {
]);
}
public function actionUpdate(int $id): string {
public function actionUpdate(): string {
return $this->actionCreate();
}
@@ -24,7 +24,7 @@ public function rules(): array {
[['title', 'url', 'source'], 'string', 'max' => 128],
['source', 'url', 'enableIDN' => true],
[['url', 'source'], 'default', 'value' => null],
[['authorId'], 'exist', 'skipOnError' => true, 'targetClass' => User::className(), 'targetAttribute' => ['authorId' => 'id']],
[['authorId'], 'exist', 'skipOnError' => true, 'targetClass' => User::class, 'targetAttribute' => ['authorId' => 'id']],
[['pdf', 'active'], 'boolean'],
];
}
@@ -116,11 +116,11 @@ public static function getLastModified(): int {
}
public function getAuthor() {
return $this->hasOne(User::className(), ['id' => 'authorId']);
return $this->hasOne(User::class, ['id' => 'authorId']);
}
public function getComments() {
return $this->hasMany(ArticlesComments::className(), ['parent' => 'id']);
return $this->hasMany(ArticlesComments::class, ['parent' => 'id']);
}
public static function find(): Query {
@@ -25,12 +25,12 @@ public function rules(): array {
['email', 'string', 'max' => 50],
[['name', 'email', 'website'], 'default', 'value' => null],
['active', 'default', 'value' => 0],
['user', 'exist', 'skipOnError' => true, 'targetClass' => User::className(), 'targetAttribute' => ['user' => 'id']],
['parent', 'exist', 'skipOnError' => false, 'targetClass' => Articles::className(), 'targetAttribute' => ['parent' => 'id']],
['user', 'exist', 'skipOnError' => true, 'targetClass' => User::class, 'targetAttribute' => ['user' => 'id']],
['parent', 'exist', 'skipOnError' => false, 'targetClass' => Articles::class, 'targetAttribute' => ['parent' => 'id']],
];
if (Yii::$app->user->isGuest) :
$rules[] = ['captcha', ReCaptchaValidator::className()];
$rules[] = ['captcha', ReCaptchaValidator::class];
$rules[] = [['name', 'email'], 'required'];
endif;
return $rules;
@@ -94,11 +94,11 @@ public function sendCommentMail(Articles $model, self $comment): void {
}
public function getAuthor() {
return $this->hasOne(User::className(), ['id' => 'user']);
return $this->hasOne(User::class, ['id' => 'user']);
}
public function getArticle() {
return $this->hasOne(Articles::className(), ['id' => 'parent']);
return $this->hasOne(Articles::class, ['id' => 'parent']);
}
public static function find() {
@@ -29,7 +29,7 @@ public static function albumsList(): BatchQueryResult {
}
public function getAlbums(): LyricsQuery {
return $this->hasMany(Lyrics2Albums::className(), ['parent' => 'id'])
return $this->hasMany(Lyrics2Albums::class, ['parent' => 'id'])
->orderBy(['year' => SORT_DESC, 'name' => SORT_ASC]);
}
@@ -92,11 +92,11 @@ public static function getLastModified(string $artist): int {
}
public function getArtist(): LyricsQuery {
return $this->hasOne(Lyrics1Artists::className(), ['id' => 'parent']);
return $this->hasOne(Lyrics1Artists::class, ['id' => 'parent']);
}
public function getTracks(): ActiveQuery {
return $this->hasMany(Lyrics3Tracks::className(), ['parent' => 'id']);
return $this->hasMany(Lyrics3Tracks::class, ['parent' => 'id']);
}
public static function find(): LyricsQuery {
@@ -53,11 +53,11 @@ public function getArtist(): ActiveQuery {
}
public function getAlbum(): ActiveQuery {
return $this->hasOne(Lyrics2Albums::className(), ['id' => 'parent']);
return $this->hasOne(Lyrics2Albums::class, ['id' => 'parent']);
}
public function getLyrics(): ActiveQuery {
return $this->hasOne(Lyrics4Lyrics::className(), ['id' => 'lyricid']);
return $this->hasOne(Lyrics4Lyrics::class, ['id' => 'lyricid']);
}
public static function find(): ActiveQuery {
@@ -20,7 +20,7 @@ public function rules(): array {
['email', 'string', 'max' => 50],
['email', 'email', 'checkDNS' => true, 'enableIDN' => true],
['attachment', 'file', 'minSize' => 64, 'maxSize' => 1024 * 1024 * 5],
['captcha', ReCaptchaValidator::className()],
['captcha', ReCaptchaValidator::class],
];
}
@@ -13,7 +13,7 @@ public function attributeLabels(): array {
public function rules(): array {
$rules = parent::rules();
$rules[] = ['captcha', ReCaptchaValidator::className()];
$rules[] = ['captcha', ReCaptchaValidator::class];
return $rules;
}
}
@@ -42,7 +42,7 @@
->hint(Yii::t('mr42', 'You may use {markdown}. HTML is not allowed.', ['markdown' => Html::a(Yii::t('mr42', 'Markdown Syntax'), ['/permalink/articles', 'id' => 4], ['target' => '_blank'])]));
if (Yii::$app->user->isGuest)
echo $form->field($model, 'captcha')->widget(ReCaptcha::className())->label(false);
echo $form->field($model, 'captcha')->widget(ReCaptcha::class)->label(false);
echo Html::tag('div',
Html::resetButton(Yii::t('mr42', 'Reset'), ['class' => 'btn btn-default ml-1', 'tabindex' => $tab + 2]).
@@ -46,7 +46,7 @@
])->fileInput(['class' => 'custom-file-input', 'id' => 'sourceFile', 'tabindex' => ++$tab])
->label(Yii::t('mr42', 'Select a File'), ['class' => 'custom-file-label text-truncate']);
echo $form->field($model, 'captcha')->widget(ReCaptcha::className())->label(false);
echo $form->field($model, 'captcha')->widget(ReCaptcha::class)->label(false);
echo Html::tag('div',
Html::resetButton(Yii::t('mr42', 'Reset'), ['class' => 'btn btn-default ml-1', 'tabindex' => $tab + 2]).
@@ -37,7 +37,7 @@
endif;
echo Html::endTag('div');
echo $form->field($model, 'captcha')->widget(ReCaptcha::className())->label(false);
echo $form->field($model, 'captcha')->widget(ReCaptcha::class)->label(false);
echo Html::submitButton(Yii::t('usuario', 'Sign up'), ['class' => 'btn btn-success btn-block', 'tabindex' => ++$tab]);

0 comments on commit b93c63b

Please sign in to comment.
You can’t perform that action at this time.