renaming clients to apps
This commit is contained in:
parent
69acbb704a
commit
e105e29f9d
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
namespace BeyondCode\LaravelWebSockets\Apps;
|
namespace BeyondCode\LaravelWebSockets\Apps;
|
||||||
|
|
||||||
use BeyondCode\LaravelWebSockets\Exceptions\InvalidClient;
|
use BeyondCode\LaravelWebSockets\Exceptions\InvalidApp;
|
||||||
|
|
||||||
class App
|
class App
|
||||||
{
|
{
|
||||||
|
|
@ -31,15 +31,15 @@ class App
|
||||||
public function __construct($appId, string $appKey, string $appSecret, ?string $name)
|
public function __construct($appId, string $appKey, string $appSecret, ?string $name)
|
||||||
{
|
{
|
||||||
if (!is_numeric($appId)) {
|
if (!is_numeric($appId)) {
|
||||||
throw InvalidClient::appIdIsNotNumeric($appId);
|
throw InvalidApp::appIdIsNotNumeric($appId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($appKey === '') {
|
if ($appKey === '') {
|
||||||
throw InvalidClient::valueIsRequired('appKey', $appId);
|
throw InvalidApp::valueIsRequired('appKey', $appId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($appSecret === '') {
|
if ($appSecret === '') {
|
||||||
throw InvalidClient::valueIsRequired('appSecret', $appId);
|
throw InvalidApp::valueIsRequired('appSecret', $appId);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->appId = $appId;
|
$this->appId = $appId;
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ namespace BeyondCode\LaravelWebSockets\Exceptions;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
class InvalidClient extends Exception
|
class InvalidApp extends Exception
|
||||||
{
|
{
|
||||||
public static function notFound(int $appId)
|
public static function notFound(int $appId)
|
||||||
{
|
{
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
namespace BeyondCode\LaravelWebSockets\Tests\ClientProviders;
|
namespace BeyondCode\LaravelWebSockets\Tests\ClientProviders;
|
||||||
|
|
||||||
use BeyondCode\LaravelWebSockets\Apps\App;
|
use BeyondCode\LaravelWebSockets\Apps\App;
|
||||||
use BeyondCode\LaravelWebSockets\Exceptions\InvalidClient;
|
use BeyondCode\LaravelWebSockets\Exceptions\InvalidApp;
|
||||||
use BeyondCode\LaravelWebSockets\Tests\TestCase;
|
use BeyondCode\LaravelWebSockets\Tests\TestCase;
|
||||||
|
|
||||||
class ClientTest extends TestCase
|
class ClientTest extends TestCase
|
||||||
|
|
@ -19,7 +19,7 @@ class ClientTest extends TestCase
|
||||||
/** @test */
|
/** @test */
|
||||||
public function it_will_not_accept_an_empty_appKey()
|
public function it_will_not_accept_an_empty_appKey()
|
||||||
{
|
{
|
||||||
$this->expectException(InvalidClient::class);
|
$this->expectException(InvalidApp::class);
|
||||||
|
|
||||||
new App(1, '', 'appSecret', 'new');
|
new App(1, '', 'appSecret', 'new');
|
||||||
}
|
}
|
||||||
|
|
@ -27,7 +27,7 @@ class ClientTest extends TestCase
|
||||||
/** @test */
|
/** @test */
|
||||||
public function it_will_not_accept_an_empty_appSecret()
|
public function it_will_not_accept_an_empty_appSecret()
|
||||||
{
|
{
|
||||||
$this->expectException(InvalidClient::class);
|
$this->expectException(InvalidApp::class);
|
||||||
|
|
||||||
new App(1, 'appKey', '', 'new');
|
new App(1, 'appKey', '', 'new');
|
||||||
}
|
}
|
||||||
|
|
@ -35,7 +35,7 @@ class ClientTest extends TestCase
|
||||||
/** @test */
|
/** @test */
|
||||||
public function it_will_not_accept_an_non_numeric_appId()
|
public function it_will_not_accept_an_non_numeric_appId()
|
||||||
{
|
{
|
||||||
$this->expectException(InvalidClient::class);
|
$this->expectException(InvalidApp::class);
|
||||||
|
|
||||||
new App('appId', 'appKey', '', 'new');
|
new App('appId', 'appKey', '', 'new');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue