Skip to content
This repository was archived by the owner on Jan 25, 2023. It is now read-only.

Commit 32a6a09

Browse files
committed
Added Lumia device detection
1 parent a0cc0f1 commit 32a6a09

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# CHANGELOG
22

3+
## 6.0.4 (released 2016-07-27)
4+
5+
- Fixed Windows Phone detection
6+
- Added Lumia device detection
7+
38
## 6.0.3 (released 2016-07-25)
49

510
- Fixed BB10 detection

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ The Device class allow you to detect a user's device.
140140
* iPad
141141
* iPhone
142142
* Windows Phone
143+
* Lumia
143144

144145
### Usage
145146

src/DeviceDetector.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ private static function checkIphone(Device $device, UserAgent $userAgent)
6666
private static function checkWindowsPhone(Device $device, UserAgent $userAgent)
6767
{
6868
if (stripos($userAgent->getUserAgentString(), 'Windows Phone') !== false) {
69+
if (preg_match('/Microsoft; (Lumia [^)]*)\)/', $userAgent->getUserAgentString(), $matches)) {
70+
$device->setName($matches[1]);
71+
return true;
72+
}
73+
6974
$device->setName($device::WINDOWS_PHONE);
7075
return true;
7176
}

0 commit comments

Comments
 (0)