Skip to content

Commit

Permalink
fix coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
sgiehl committed Mar 21, 2020
1 parent c8d8711 commit d95cbad
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion DeviceDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ protected function parseDevice(): void
* See https://developer.chrome.com/multidevice/user-agent#chrome_for_android_user_agent
*/
if (null === $this->device && 'Android' === $osFamily
&& 'Chrome' == Browser::getBrowserFamily($this->getClient('short_name'))
&& 'Chrome' === Browser::getBrowserFamily($this->getClientAttribute('name'))
) {
if ($this->matchUserAgent('Chrome/[\.0-9]* Mobile')) {
$this->device = AbstractDeviceParser::DEVICE_TYPE_SMARTPHONE;
Expand Down
6 changes: 5 additions & 1 deletion Parser/Client/Browser.php
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,11 @@ public function parse(): ?array
}

// This Exception should never be thrown. If so a defined browser name is missing in $availableBrowsers
throw new \Exception(sprintf('Detected browser name "%s" was not found in $availableBrowsers. Tried to parse user agent: %s', $name, $this->userAgent)); // @codeCoverageIgnore
throw new \Exception(sprintf(
'Detected browser name "%s" was not found in $availableBrowsers. Tried to parse user agent: %s',
$name,
$this->userAgent
)); // @codeCoverageIgnore
}

/**
Expand Down
5 changes: 4 additions & 1 deletion Parser/Client/Browser/Engine.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ public function parse(): ?array
}

// This Exception should never be thrown. If so a defined browser name is missing in $availableEngines
throw new \Exception(sprintf('Detected browser engine was not found in $availableEngines. Tried to parse user agent: %s', $this->userAgent)); // @codeCoverageIgnore
throw new \Exception(sprintf(
'Detected browser engine was not found in $availableEngines. Tried to parse user agent: %s',
$this->userAgent
)); // @codeCoverageIgnore
}
}
8 changes: 7 additions & 1 deletion Parser/Device/AbstractDeviceParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,13 @@ public function parse(): ?array

if (false === $brandId) {
// This Exception should never be thrown. If so a defined brand name is missing in $deviceBrands
throw new \Exception(sprintf("The brand with name '%s' should be listed in the deviceBrands array. Tried to parse user agent: %s", $brand, $this->userAgent)); // @codeCoverageIgnore
throw new \Exception(
sprintf(
"The brand name '%s' needs to be in deviceBrands array. Tried parsing user agent: %s",
$brand,
$this->userAgent
)
); // @codeCoverageIgnore
}

$this->brand = (string) $brandId;
Expand Down

0 comments on commit d95cbad

Please sign in to comment.