diff --git a/.gitignore b/.gitignore index b0c31dd..7778af0 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ composer.lock package-lock.json /lib/ +/tests/.phpunit.result.cache diff --git a/RemoteCalls.php b/RemoteCalls.php index efb6dd3..084a673 100644 --- a/RemoteCalls.php +++ b/RemoteCalls.php @@ -57,11 +57,17 @@ public static function getVariable($name) */ public static function check() { - return - static::getVariable('spbc_remote_call_token') && - static::getVariable('spbc_remote_call_action') && - static::getVariable('plugin_name') && - in_array(static::getVariable('plugin_name'), array('antispam', 'anti-spam', 'apbct')); + if (static::getVariable('spbc_remote_call_action')) { + static::getVariable('spbc_remote_call_token') + ? self::checkWithToken() + : false; + } + return false; + } + + public static function checkWithToken() + { + return in_array(static::getVariable('plugin_name'), array('antispam', 'anti-spam', 'apbct')); } /** diff --git a/tests/RemoteCalls/RemoteCallsTest.php b/tests/RemoteCalls/RemoteCallsTest.php index f576cf4..083c96d 100644 --- a/tests/RemoteCalls/RemoteCallsTest.php +++ b/tests/RemoteCalls/RemoteCallsTest.php @@ -8,7 +8,7 @@ class RemoteCallsTest extends TestCase { - public function setUp() + public function setUp(): void { /** @var \Cleantalk\Common\StorageHandler\StorageHandler $storage_handler */ $storage_handler = $this->generateStorageHandlerMockObject(); @@ -44,7 +44,7 @@ private function generateStorageHandlerMockObject() return $mock; } - public function tearDown() + public function tearDown(): void { Request::resetInstance(); } diff --git a/tests/RemoteCalls/RemoteCallsTestWrongRequest.php b/tests/RemoteCalls/RemoteCallsTestWrongRequest.php index 7874d27..73b5f3c 100644 --- a/tests/RemoteCalls/RemoteCallsTestWrongRequest.php +++ b/tests/RemoteCalls/RemoteCallsTestWrongRequest.php @@ -9,7 +9,7 @@ class RemoteCallsTestWrongRequest extends TestCase { - public function setUp() + public function setUp(): void { /** @var \Cleantalk\Common\StorageHandler\StorageHandler $storage_handler */ $storage_handler = $this->generateStorageHandlerMockObject(); @@ -37,7 +37,7 @@ private function generateStorageHandlerMockObject() return $mock; } - public function tearDown() + public function tearDown(): void { Request::resetInstance(); }