Apply fixes from StyleCI

This commit is contained in:
StyleCI Bot 2022-01-04 23:31:59 +00:00
parent 178f91aff9
commit e5ba4f4320
5 changed files with 8 additions and 9 deletions

View File

@ -38,7 +38,7 @@ class Akismet
public function isConfigured(): bool
{
return !empty($this->apiKey);
return ! empty($this->apiKey);
}
/**
@ -48,6 +48,7 @@ class Akismet
protected function sendRequest(string $type): ResponseInterface
{
$client = new Client();
return $client->request('POST', "$this->apiUrl/$type", [
'headers' => [
'User-Agent' => "Flarum/$this->flarumVersion | Akismet/$this->extensionVersion",
@ -147,7 +148,7 @@ class Akismet
* contact-form: A contact form or feedback form submission.
* signup: A new user account.
* message: A message sent between just a few users.
* You may send a value not listed above if none of them accurately describe your content. This is further explained here: https://blog.akismet.com/2012/06/19/pro-tip-tell-us-your-comment_type/
* You may send a value not listed above if none of them accurately describe your content. This is further explained here: https://blog.akismet.com/2012/06/19/pro-tip-tell-us-your-comment_type/.
*/
public function withType(string $type): Akismet
{
@ -226,4 +227,3 @@ class Akismet
return $this->withParam('recheck_reason', $reason);
}
}

View File

@ -26,7 +26,7 @@ class SubmitHam
public function handle(PostWasApproved $event)
{
if (!$this->akismet->isConfigured()) {
if (! $this->akismet->isConfigured()) {
return;
}

View File

@ -26,7 +26,7 @@ class SubmitSpam
public function handle(Hidden $event)
{
if (!$this->akismet->isConfigured()) {
if (! $this->akismet->isConfigured()) {
return;
}

View File

@ -35,14 +35,14 @@ class ValidatePost
public function handle(Saving $event)
{
if (!$this->akismet->isConfigured()) {
if (! $this->akismet->isConfigured()) {
return;
}
$post = $event->post;
//TODO Sometimes someone posts spam when editing a post. In this case 'recheck_reason=edit' can be used when sending a request to Akismet
if ($post->exists || !($post instanceof CommentPost) || $post->user->hasPermission('bypassAkismet')) {
if ($post->exists || ! ($post instanceof CommentPost) || $post->user->hasPermission('bypassAkismet')) {
return;
}
@ -55,7 +55,6 @@ class ValidatePost
->withUserAgent($_SERVER['HTTP_USER_AGENT'])
->checkSpam();
if ($result['isSpam']) {
$post->is_spam = true;

View File

@ -9,13 +9,13 @@
namespace Flarum\Akismet\Provider;
use Flarum\Akismet\Akismet;
use Flarum\Extension\ExtensionManager;
use Flarum\Foundation\AbstractServiceProvider;
use Flarum\Foundation\Application;
use Flarum\Foundation\Config;
use Flarum\Http\UrlGenerator;
use Flarum\Settings\SettingsRepositoryInterface;
use Flarum\Akismet\Akismet;
use Illuminate\Container\Container;
class AkismetProvider extends AbstractServiceProvider