Skip to content

Commit 7a9bfa1

Browse files
committed
Require php 5.4
1 parent adf64bd commit 7a9bfa1

File tree

7 files changed

+143
-139
lines changed

7 files changed

+143
-139
lines changed

.gitattributes

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
/tests export-ignore
2-
/.gitattributes export-ignore
3-
/.gitignore export-ignore
4-
/.travis.yml export-ignore
2+
/.* export-ignore
53
/phpunit.xml export-ignore

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
language: php
22

33
php:
4-
- 5.3
54
- 5.4
65
- 5.5
76
- 5.6
87
- 7.0
8+
- 7.1
99
- hhvm
1010

1111
sudo: false

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
}
1212
],
1313
"require": {
14-
"php": ">=5.3.0",
14+
"php": ">=5.4.0",
1515
"illuminate/support": "^4.0|^5.0",
1616
"mobiledetect/mobiledetectlib": "^2.7.6"
1717
},

src/Agent.php

Lines changed: 63 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php namespace Jenssegers\Agent;
1+
<?php
2+
3+
namespace Jenssegers\Agent;
24

35
use BadMethodCallException;
46
use Mobile_Detect;
@@ -10,84 +12,84 @@ class Agent extends Mobile_Detect {
1012
*
1113
* @var array
1214
*/
13-
protected static $additionalDevices = array(
14-
'Macintosh' => 'Macintosh',
15-
);
15+
protected static $additionalDevices = [
16+
'Macintosh' => 'Macintosh',
17+
];
1618

1719
/**
1820
* List of additional operating systems.
1921
*
2022
* @var array
2123
*/
22-
protected static $additionalOperatingSystems = array(
23-
'Windows' => 'Windows',
24-
'Windows NT' => 'Windows NT',
25-
'OS X' => 'Mac OS X',
26-
'Debian' => 'Debian',
27-
'Ubuntu' => 'Ubuntu',
28-
'Macintosh' => 'PPC',
29-
'OpenBSD' => 'OpenBSD',
30-
'Linux' => 'Linux',
31-
'ChromeOS' => 'CrOS',
32-
);
24+
protected static $additionalOperatingSystems = [
25+
'Windows' => 'Windows',
26+
'Windows NT' => 'Windows NT',
27+
'OS X' => 'Mac OS X',
28+
'Debian' => 'Debian',
29+
'Ubuntu' => 'Ubuntu',
30+
'Macintosh' => 'PPC',
31+
'OpenBSD' => 'OpenBSD',
32+
'Linux' => 'Linux',
33+
'ChromeOS' => 'CrOS',
34+
];
3335

3436
/**
3537
* List of additional browsers.
36-
* Note: 'Vivaldi' must be above Chrome, otherwise it'll fail
38+
* Note: 'Vivaldi' must be above Chrome, otherwise it'll fail.
3739
*
3840
* @var array
3941
*/
40-
protected static $additionalBrowsers = array(
41-
'Opera' => 'Opera|OPR',
42-
'Edge' => 'Edge',
43-
'Vivaldi' => 'Vivaldi',
44-
'Chrome' => 'Chrome',
45-
'Firefox' => 'Firefox',
46-
'Safari' => 'Safari',
47-
'IE' => 'MSIE|IEMobile|MSIEMobile|Trident/[.0-9]+',
48-
'Netscape' => 'Netscape',
49-
'Mozilla' => 'Mozilla',
50-
);
42+
protected static $additionalBrowsers = [
43+
'Opera' => 'Opera|OPR',
44+
'Edge' => 'Edge',
45+
'Vivaldi' => 'Vivaldi',
46+
'Chrome' => 'Chrome',
47+
'Firefox' => 'Firefox',
48+
'Safari' => 'Safari',
49+
'IE' => 'MSIE|IEMobile|MSIEMobile|Trident/[.0-9]+',
50+
'Netscape' => 'Netscape',
51+
'Mozilla' => 'Mozilla',
52+
];
5153

5254
/**
5355
* List of additional properties.
5456
*
5557
* @var array
5658
*/
57-
protected static $additionalProperties = array(
59+
protected static $additionalProperties = [
5860
// Operating systems
59-
'Windows' => 'Windows NT [VER]',
60-
'Windows NT' => 'Windows NT [VER]',
61-
'OS X' => 'OS X [VER]',
62-
'BlackBerryOS' => array('BlackBerry[\w]+/[VER]', 'BlackBerry.*Version/[VER]', 'Version/[VER]'),
63-
'AndroidOS' => 'Android [VER]',
64-
'ChromeOS' => 'CrOS x86_64 [VER]',
61+
'Windows' => 'Windows NT [VER]',
62+
'Windows NT' => 'Windows NT [VER]',
63+
'OS X' => 'OS X [VER]',
64+
'BlackBerryOS' => ['BlackBerry[\w]+/[VER]', 'BlackBerry.*Version/[VER]', 'Version/[VER]'],
65+
'AndroidOS' => 'Android [VER]',
66+
'ChromeOS' => 'CrOS x86_64 [VER]',
6567

6668
// Browsers
67-
'Opera' => array(' OPR/[VER]', 'Opera Mini/[VER]', 'Version/[VER]', 'Opera [VER]'),
68-
'Netscape' => 'Netscape/[VER]',
69-
'Mozilla' => 'rv:[VER]',
70-
'IE' => array('IEMobile/[VER];', 'IEMobile [VER]', 'MSIE [VER];', 'rv:[VER]'),
71-
'Edge' => 'Edge/[VER]',
72-
'Vivaldi' => 'Vivaldi/[VER]',
73-
);
69+
'Opera' => [' OPR/[VER]', 'Opera Mini/[VER]', 'Version/[VER]', 'Opera [VER]'],
70+
'Netscape' => 'Netscape/[VER]',
71+
'Mozilla' => 'rv:[VER]',
72+
'IE' => ['IEMobile/[VER];', 'IEMobile [VER]', 'MSIE [VER];', 'rv:[VER]'],
73+
'Edge' => 'Edge/[VER]',
74+
'Vivaldi' => 'Vivaldi/[VER]',
75+
];
7476

7577
/**
7678
* List of robots.
7779
*
7880
* @var array
7981
*/
80-
protected static $robots = array(
81-
'Google' => 'googlebot',
82-
'MSNBot' => 'msnbot',
83-
'Baiduspider' => 'baiduspider',
84-
'Bing' => 'bingbot',
85-
'Yahoo' => 'yahoo',
86-
'Lycos' => 'lycos',
87-
'Facebook' => 'facebookexternalhit',
88-
'Twitter' => 'Twitterbot',
89-
'Yandex' => 'Yandex',
90-
);
82+
protected static $robots = [
83+
'Google' => 'googlebot',
84+
'MSNBot' => 'msnbot',
85+
'Baiduspider' => 'baiduspider',
86+
'Bing' => 'bingbot',
87+
'Yahoo' => 'yahoo',
88+
'Lycos' => 'lycos',
89+
'Facebook' => 'facebookexternalhit',
90+
'Twitter' => 'Twitterbot',
91+
'Yandex' => 'Yandex',
92+
];
9193

9294
/**
9395
* Get all detection rules. These rules include the additional
@@ -147,7 +149,7 @@ public function languages($acceptLanguage = null)
147149

148150
if ($acceptLanguage)
149151
{
150-
$languages = array();
152+
$languages = [];
151153

152154
// Parse accept language string.
153155
foreach (explode(',', $acceptLanguage) as $piece)
@@ -167,7 +169,7 @@ public function languages($acceptLanguage = null)
167169
return array_keys($languages);
168170
}
169171

170-
return array();
172+
return [];
171173
}
172174

173175
/**
@@ -254,7 +256,7 @@ public function device($userAgent = null)
254256
*/
255257
public function isDesktop($userAgent = null, $httpHeaders = null)
256258
{
257-
return (! $this->isMobile() && ! $this->isTablet() && ! $this->isRobot());
259+
return ! $this->isMobile() && ! $this->isTablet() && ! $this->isRobot();
258260
}
259261

260262
/**
@@ -266,7 +268,7 @@ public function isDesktop($userAgent = null, $httpHeaders = null)
266268
*/
267269
public function isPhone($userAgent = null, $httpHeaders = null)
268270
{
269-
return ($this->isMobile() && ! $this->isTablet());
271+
return $this->isMobile() && ! $this->isTablet();
270272
}
271273

272274
/**
@@ -280,8 +282,8 @@ public function robot($userAgent = null)
280282
// Get bot rules
281283
$rules = $this->mergeRules(
282284
static::$robots, // NEW
283-
array(static::$utilities['Bot']),
284-
array(static::$utilities['MobileBot'])
285+
[static::$utilities['Bot']],
286+
[static::$utilities['MobileBot']]
285287
);
286288

287289
return $this->findDetectionRulesAgainstUA($rules, $userAgent);
@@ -297,8 +299,8 @@ public function isRobot($userAgent = null)
297299
{
298300
// Get bot rules
299301
$rules = $this->mergeRules(
300-
array(static::$utilities['Bot']),
301-
array(static::$utilities['MobileBot']),
302+
[static::$utilities['Bot']],
303+
[static::$utilities['MobileBot']],
302304
static::$robots // NEW
303305
);
304306

@@ -340,7 +342,7 @@ public function version($propertyName, $type = self::VERSION_TYPE_STRING)
340342
*/
341343
protected function mergeRules()
342344
{
343-
$merged = array();
345+
$merged = [];
344346

345347
foreach (func_get_args() as $rules)
346348
{

src/AgentServiceProvider.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php namespace Jenssegers\Agent;
1+
<?php
2+
3+
namespace Jenssegers\Agent;
24

35
use Illuminate\Support\ServiceProvider;
46

src/Facades/Agent.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php namespace Jenssegers\Agent\Facades;
1+
<?php
2+
3+
namespace Jenssegers\Agent\Facades;
24

35
use Illuminate\Support\Facades\Facade;
46

0 commit comments

Comments
 (0)