Skip to content

Commit

Permalink
Rename the browser to client
Browse files Browse the repository at this point in the history
  • Loading branch information
arcanedev-maroc committed Aug 30, 2020
1 parent ad3d017 commit 71bbdef
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
20 changes: 10 additions & 10 deletions src/Detectors/DeviceDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,31 +85,31 @@ public function osVersion(): string
}

/**
* Get the browser name.
* Get the client name.
*
* @return string
*/
public function browserName()
public function clientName()
{
return $this->getClient('name');
}

/**
* Get the browser name.
* Get the client name.
*
* @return string
*/
public function browserShortName()
public function clientShortName()
{
return $this->getClient('short_name');
}

/**
* Get the browser's version.
* Get the client's version.
*
* @return string
*/
public function browserVersion(): string
public function clientVersion(): string
{
return $this->getClient('version');
}
Expand Down Expand Up @@ -140,17 +140,17 @@ public function isVisitor(): bool
*/

/**
* Check the given name matches browser's name.
* Check the given name matches client's name.
*
* @param string $name
*
* @return bool
*/
public function isBrowserName($name): bool
public function isClientName($name): bool
{
return in_array($name, [
$this->browserName(),
$this->browserShortName(),
$this->clientName(),
$this->clientShortName(),
]);
}

Expand Down
16 changes: 8 additions & 8 deletions tests/AgentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,17 @@ public function it_can_get_languages_sorted(): void
* @dataProvider provideBrowsersData
*
* @param string $userAgent
* @param array $browser
* @param array $client
*/
public function it_can_check_browsers(string $userAgent, array $browser): void
public function it_can_check_client(string $userAgent, array $client): void
{
$device = $this->parseDevice($userAgent);

static::assertEquals($browser['name'], $device->browserName(), $userAgent);
static::assertEquals($browser['short_name'], $device->browserShortName(), $userAgent);
static::assertEquals($client['name'], $device->clientName(), $userAgent);
static::assertEquals($client['short_name'], $device->clientShortName(), $userAgent);

static::assertTrue($device->isBrowserName($browser['name']), $userAgent);
static::assertTrue($device->isBrowserName($browser['short_name']), $userAgent);
static::assertTrue($device->isClientName($client['name']), $userAgent);
static::assertTrue($device->isClientName($client['short_name']), $userAgent);
}

/**
Expand All @@ -133,11 +133,11 @@ public function it_can_check_browsers(string $userAgent, array $browser): void
* @param string $userAgent
* @param string $version
*/
public function it_can_get_browser_version(string $userAgent, string $version): void
public function it_can_get_client_version(string $userAgent, string $version): void
{
$device = $this->parseDevice($userAgent);

static::assertEquals($version, $device->browserVersion(), $userAgent);
static::assertEquals($version, $device->clientVersion(), $userAgent);
}

/**
Expand Down

0 comments on commit 71bbdef

Please sign in to comment.