Completed
Branch 3.0.0 (1f43e9)
by Serhii
03:00
created
src/Device.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,8 +25,7 @@
 block discarded – undo
25 25
         {
26 26
             $this->Name = 'Desktop';
27 27
             $this->Type = 'desktop';
28
-        }
29
-        else
28
+        } else
30 29
         {
31 30
             parent::__construct($xmlData);
32 31
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
      */
22 22
     public function __construct(\SimpleXMLElement $xmlData)
23 23
     {
24
-        if($xmlData === null || $xmlData->getName() == 'null')
24
+        if ($xmlData === null || $xmlData->getName() == 'null')
25 25
         {
26 26
             parent::__construct($xmlData);
27 27
 
Please login to merge, or discard this patch.
src/OS.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     public function __construct(\SimpleXMLElement $xmlData)
23 23
     {
24 24
         parent::__construct($xmlData);
25
-        if($xmlData !== null)
25
+        if ($xmlData !== null)
26 26
         {
27 27
             foreach ($xmlData->children() as $child) {
28 28
                 switch ($child->getName()) {
@@ -46,6 +46,6 @@  discard block
 block discarded – undo
46 46
 
47 47
 }
48 48
 
49
-define('UNX','unix');
50
-define('WIN','windows');
51
-define('MC','mac');
49
+define('UNX', 'unix');
50
+define('WIN', 'windows');
51
+define('MC', 'mac');
Please login to merge, or discard this patch.
tests/BrowserTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
      */
18 18
     public function testFirefox()
19 19
     {
20
-        $this->assertEquals('Firefox',Detector::analyse('Mozilla/5.0 (Windows NT 6.3; WOW64; rv:46.0) Gecko/20100101 Firefox/46.0 ')->Browser->getName());
20
+        $this->assertEquals('Firefox', Detector::analyse('Mozilla/5.0 (Windows NT 6.3; WOW64; rv:46.0) Gecko/20100101 Firefox/46.0 ')->Browser->getName());
21 21
     }
22 22
 
23 23
     /**
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      */
26 26
     public function testOpera()
27 27
     {
28
-        $this->assertEquals('Opera',Detector::analyse('Opera/9.80 (X11; Linux i686; Ubuntu/14.10) Presto/2.12.388 Version/12.16')->Browser->getName());
28
+        $this->assertEquals('Opera', Detector::analyse('Opera/9.80 (X11; Linux i686; Ubuntu/14.10) Presto/2.12.388 Version/12.16')->Browser->getName());
29 29
     }
30 30
 
31 31
 
Please login to merge, or discard this patch.
src/Data.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@
 block discarded – undo
72 72
     {
73 73
         parent::__construct($xmlData);
74 74
 
75
-        if($xmlData !== null)
75
+        if ($xmlData !== null)
76 76
         {
77 77
             foreach ($xmlData->children() as $child)
78 78
             {
Please login to merge, or discard this patch.
tests/DeviceTest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
             'Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543 Safari/419.3'
22 22
         );
23 23
 
24
-        testUaList($this,'Device','Name',$ualist,'iPhone');
25
-        testUaListIsProperty($this,'isMobile',$ualist,true);
24
+        testUaList($this, 'Device', 'Name', $ualist, 'iPhone');
25
+        testUaListIsProperty($this, 'isMobile', $ualist, true);
26 26
     }
27 27
 
28 28
     public function testIPad()
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
             'Mozilla/5.0 (iPad; CPU OS 5_1_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Mobile/9B206'
35 35
         );
36 36
 
37
-        testUaList($this,'Device','Name',$ualist,'iPad');
37
+        testUaList($this, 'Device', 'Name', $ualist, 'iPad');
38 38
     }
39 39
 
40 40
     public function testLumia()
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
             'Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0; NOKIA; Lumia 900)'
47 47
         );
48 48
 
49
-        testUaList($this,'Device','Name',$ualist,'Lumia');
50
-        testUaListIsProperty($this,'isMobile',$ualist,true);
49
+        testUaList($this, 'Device', 'Name', $ualist, 'Lumia');
50
+        testUaListIsProperty($this, 'isMobile', $ualist, true);
51 51
     }
52 52
 }
Please login to merge, or discard this patch.
tests/OsTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
             'Mozilla/1.1I (X11; I; UNIX_SV 4.2MP R4000)',
19 19
         );
20 20
 
21
-        testUaList($this,'OS','Name',$ualist,'Linux');
21
+        testUaList($this, 'OS', 'Name', $ualist, 'Linux');
22 22
     }
23 23
 
24 24
     public function testAIX()
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
             'Mozilla/4.04j2 [en] (X11; I; AIX 4.2) ',
28 28
         );
29 29
 
30
-        testUaList($this,'OS','Name',$ualist,'AIX');
30
+        testUaList($this, 'OS', 'Name', $ualist, 'AIX');
31 31
     }
32 32
 
33 33
     public function testAliyunOS()
@@ -36,6 +36,6 @@  discard block
 block discarded – undo
36 36
             'Mozilla/5.0 (Linux; U; AliyunOS 2.0; Android 4.0 Compatible; xx; R819T Build/AliyunOs-2012) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30',
37 37
         );
38 38
 
39
-        testUaList($this,'OS','Name',$ualist,'Aliyun OS');
39
+        testUaList($this, 'OS', 'Name', $ualist, 'Aliyun OS');
40 40
     }
41 41
 }
42 42
\ No newline at end of file
Please login to merge, or discard this patch.
tests/bootstrap.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -7,15 +7,15 @@  discard block
 block discarded – undo
7 7
  * @project browser-detector
8 8
  */
9 9
 
10
-$vendor = realpath(__DIR__ . '/../vendor/');
10
+$vendor = realpath(__DIR__.'/../vendor/');
11 11
 
12
-define('__SRC__',str_replace('tests','src',__DIR__));
13
-if (file_exists($vendor . '/autoload.php')) {
14
-    require $vendor . '/autoload.php';
12
+define('__SRC__', str_replace('tests', 'src', __DIR__));
13
+if (file_exists($vendor.'/autoload.php')) {
14
+    require $vendor.'/autoload.php';
15 15
 } else {
16
-    $vendor = realpath(__DIR__ . '/../../../');
17
-    if (file_exists($vendor . '/autoload.php')) {
18
-        require $vendor . '/autoload.php';
16
+    $vendor = realpath(__DIR__.'/../../../');
17
+    if (file_exists($vendor.'/autoload.php')) {
18
+        require $vendor.'/autoload.php';
19 19
     } else {
20 20
         throw new Exception('Unable to load dependencies');
21 21
     }
@@ -28,30 +28,30 @@  discard block
 block discarded – undo
28 28
 $loader->addPrefix('EndorphinStudio\\Detector', __SRC__);
29 29
 $loader->register();
30 30
 
31
-function testUaList($object,$detectorProperty,$property,$uaList,$expectedValue)
31
+function testUaList($object, $detectorProperty, $property, $uaList, $expectedValue)
32 32
 {
33
-    foreach($uaList as $ua)
33
+    foreach ($uaList as $ua)
34 34
     {
35 35
         $obj = Detector::analyse($ua)->$detectorProperty;
36 36
         $func = 'get'.$property;
37
-        $object->assertEquals($expectedValue,$obj->$func());
37
+        $object->assertEquals($expectedValue, $obj->$func());
38 38
     }
39 39
 }
40 40
 
41
-function testUaListBooleanTrue($object,$detectorProperty,$property,$uaList)
41
+function testUaListBooleanTrue($object, $detectorProperty, $property, $uaList)
42 42
 {
43
-    foreach($uaList as $ua)
43
+    foreach ($uaList as $ua)
44 44
     {
45 45
         $obj = Detector::analyse($ua)->$detectorProperty;
46 46
         $func = 'is'.$property;
47
-        $object->assertTrue($obj->$func(),'Object Property '.$property.' is no equal TRUE');
47
+        $object->assertTrue($obj->$func(), 'Object Property '.$property.' is no equal TRUE');
48 48
     }
49 49
 }
50 50
 
51
-function testUaListIsProperty($object,$detectorProperty,$uaList,$expectedValue)
51
+function testUaListIsProperty($object, $detectorProperty, $uaList, $expectedValue)
52 52
 {
53
-    foreach($uaList as $ua)
53
+    foreach ($uaList as $ua)
54 54
     {
55
-        $object->assertEquals($expectedValue,Detector::analyse($ua)->$detectorProperty);
55
+        $object->assertEquals($expectedValue, Detector::analyse($ua)->$detectorProperty);
56 56
     }
57 57
 }
58 58
\ No newline at end of file
Please login to merge, or discard this patch.
src/Robot.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     {
73 73
         parent::__construct($xmlData);
74 74
 
75
-        if($xmlData !== null)
75
+        if ($xmlData !== null)
76 76
         {
77 77
             foreach ($xmlData->children() as $child)
78 78
             {
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
                         break;
87 87
                     case 'isse':
88 88
                         $val = $child->__toString();
89
-                        if($val == 'true')
89
+                        if ($val == 'true')
90 90
                         {
91 91
                             $this->setSearchEngine(true);
92 92
                         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -89,9 +89,9 @@
 block discarded – undo
89 89
                         if($val == 'true')
90 90
                         {
91 91
                             $this->setSearchEngine(true);
92
+                        } else {
93
+                                                    $this->setSearchEngine(false);
92 94
                         }
93
-                        else
94
-                            $this->setSearchEngine(false);
95 95
                         break;
96 96
                 }
97 97
             }
Please login to merge, or discard this patch.
src/DetectorRule.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 
105 105
     public function __construct(\SimpleXMLElement $xmlData)
106 106
     {
107
-        if($xmlData !== null)
107
+        if ($xmlData !== null)
108 108
         {
109 109
             foreach ($xmlData->children() as $child) {
110 110
                 switch ($child->getName())
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
                         break;
124 124
                     case 'targetProperty':
125 125
                         $boolVal = $child->__toString();
126
-                        if($boolVal == 'true')
126
+                        if ($boolVal == 'true')
127 127
                         {
128 128
                             $this->TargetValue = true;
129 129
                         }
@@ -142,15 +142,15 @@  discard block
 block discarded – undo
142 142
      */
143 143
     public static function loadRulesFromFile()
144 144
     {
145
-        $path = str_replace('src','data',__DIR__).'/rules/';
145
+        $path = str_replace('src', 'data', __DIR__).'/rules/';
146 146
         $files = scandir($path);
147 147
         $rules = array();
148
-        foreach($files as $file)
148
+        foreach ($files as $file)
149 149
         {
150
-            if($file != '.' && $file != '..')
150
+            if ($file != '.' && $file != '..')
151 151
             {
152 152
                 $xmlObj = simplexml_load_file($path.$file);
153
-                foreach($xmlObj->children() as $rule)
153
+                foreach ($xmlObj->children() as $rule)
154 154
                 {
155 155
                     $rules[] = new self($rule);
156 156
                 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -126,8 +126,7 @@
 block discarded – undo
126 126
                         if($boolVal == 'true')
127 127
                         {
128 128
                             $this->TargetValue = true;
129
-                        }
130
-                        else
129
+                        } else
131 130
                         {
132 131
                             $this->TargetValue = false;
133 132
                         }
Please login to merge, or discard this patch.