Skip to content

Commit

Permalink
Merge pull request #626 from summercms/PlayStation
Browse files Browse the repository at this point in the history
Correct PlayStation brand name and add PS5
  • Loading branch information
NielsLeenheer authored Apr 12, 2022
2 parents d4bd911 + 5e8cc47 commit e13402b
Show file tree
Hide file tree
Showing 6 changed files with 140 additions and 118 deletions.
2 changes: 1 addition & 1 deletion data/applications-browsers.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@
[ 'name' => 'Aplix', 'id' => 'aplix', 'regexp' =>'/Aplix_SEGASATURN_browser\/([0-9](?:.[0-9.]+)?)/u' ], // browser for the Sega Saturn
[ 'name' => 'Bunjalloo', 'id' => 'bunjalloo', 'regexp' =>'/Bunjalloo\/([0-9.]*)/u' ], // browser for the Nintento DS
[ 'name' => 'Nintendo Web Framework', 'id' => 'nwf', 'regexp' =>'/NWF\/([0-9.]*)/u', 'details' => 2 ], // browser for the Sega Dreamcast
[ 'name' => 'Nuanti Meta', 'id' => 'nuanti', 'regexp' =>'/Nuanti(?:Meta)?\/([0-9.]*)/u' ], // browser for the Playstation
[ 'name' => 'Nuanti Meta', 'id' => 'nuanti', 'regexp' =>'/Nuanti(?:Meta)?\/([0-9.]*)/u' ], // browser for the PlayStation

/* Other browsers */
[ 'name' => 'Wear Internet Browser','id' => 'wib', 'regexp' =>'/WIB\/([0-9.]*)/u' ],
Expand Down
2 changes: 1 addition & 1 deletion src/Analyser/Corrections.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ private function hideBrowserBasedOnOperatingSystem()

private function hideBrowserOnDeviceTypeGaming()
{
if (isset($this->data->device->model) && $this->data->device->model == 'Playstation 2' && $this->data->browser->name == 'Internet Explorer') {
if (isset($this->data->device->model) && $this->data->device->model == 'PlayStation 2' && $this->data->browser->name == 'Internet Explorer') {
$this->data->browser->reset();
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Analyser/Header/Useragent/Browser.php
Original file line number Diff line number Diff line change
Expand Up @@ -1365,7 +1365,7 @@ private function detectNetfront($ua)
if (in_array($match[1], [ 'ACCESS/NFPS', 'SUNSOFT/EnjoyMagic' ])) {
$this->data->device->setIdentification([
'manufacturer' => 'Sony',
'model' => 'Playstation 2',
'model' => 'PlayStation 2',
'type' => Constants\DeviceType::GAMING,
'subtype' => Constants\DeviceSubType::CONSOLE
]);
Expand Down Expand Up @@ -2447,7 +2447,7 @@ private function detectTelevisionBrowsers($ua)
if (preg_match('/SPS/u', $ua, $match)) {
$this->data->device->setIdentification([
'manufacturer' => 'Sony',
'model' => 'Playstation 2',
'model' => 'PlayStation 2',
'type' => Constants\DeviceType::GAMING,
'subtype' => Constants\DeviceSubType::CONSOLE
]);
Expand Down
30 changes: 22 additions & 8 deletions src/Analyser/Header/Useragent/Device/Gaming.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,39 +132,39 @@ private function detectPlaystation($ua)

$this->data->device->setIdentification([
'manufacturer' => 'Sony',
'model' => 'Playstation Portable',
'model' => 'PlayStation Portable',
'type' => Constants\DeviceType::GAMING,
'subtype' => Constants\DeviceSubType::PORTABLE
]);
}

/* PlayStation Vita */

if (preg_match('/PlayStation Vita/iu', $ua)) {
if (preg_match('/PlayStation Vita/ui', $ua)) {
$this->data->os->reset();
$this->data->os->identifyVersion('/PlayStation Vita ([0-9.]*)/u', $ua);

$this->data->device->setIdentification([
'manufacturer' => 'Sony',
'model' => 'Playstation Vita',
'model' => 'PlayStation Vita',
'type' => Constants\DeviceType::GAMING,
'subtype' => Constants\DeviceSubType::PORTABLE
]);

if (preg_match('/VTE\//u', $ua)) {
$this->data->device->model = 'Playstation TV';
$this->data->device->model = 'PlayStation TV';
$this->data->device->subtype = Constants\DeviceSubType::CONSOLE;
}
}

/* PlayStation 2 */

if (preg_match('/Playstation2/u', $ua) || preg_match('/\(PS2/u', $ua)) {
if (preg_match('/PlayStation2/ui', $ua) || preg_match('/\(PS2/u', $ua)) {
$this->data->os->reset();

$this->data->device->setIdentification([
'manufacturer' => 'Sony',
'model' => 'Playstation 2',
'model' => 'PlayStation 2',
'type' => Constants\DeviceType::GAMING,
'subtype' => Constants\DeviceSubType::CONSOLE
]);
Expand All @@ -184,7 +184,7 @@ private function detectPlaystation($ua)

$this->data->device->setIdentification([
'manufacturer' => 'Sony',
'model' => 'Playstation 3',
'model' => 'PlayStation 3',
'type' => Constants\DeviceType::GAMING,
'subtype' => Constants\DeviceSubType::CONSOLE
]);
Expand All @@ -198,7 +198,21 @@ private function detectPlaystation($ua)

$this->data->device->setIdentification([
'manufacturer' => 'Sony',
'model' => 'Playstation 4',
'model' => 'PlayStation 4',
'type' => Constants\DeviceType::GAMING,
'subtype' => Constants\DeviceSubType::CONSOLE
]);
}

/* PlayStation 5 */

if (preg_match('/PlayStation 5/ui', $ua) || preg_match('/\(PS5/u', $ua)) {
$this->data->os->reset();
$this->data->os->identifyVersion('/PlayStation 5 ([0-9.]*)/u', $ua);

$this->data->device->setIdentification([
'manufacturer' => 'Sony',
'model' => 'PlayStation 5',
'type' => Constants\DeviceType::GAMING,
'subtype' => Constants\DeviceSubType::CONSOLE
]);
Expand Down
Loading

0 comments on commit e13402b

Please sign in to comment.