Completed
Push — 4.0 ( 0bf83a )
by Serhii
03:33
created
oldSrc/Result/DeviceModel.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
     public function __construct(\SimpleXMLElement $xmlData)
70 70
     {
71
-        if($xmlData !== null)
71
+        if ($xmlData !== null)
72 72
         {
73 73
             foreach ($xmlData->children() as $child)
74 74
             {
@@ -84,10 +84,10 @@  discard block
 block discarded – undo
84 84
      */
85 85
     public static function loadFromFile()
86 86
     {
87
-        $path = str_replace('src','data',__DIR__).'/deviceModels.xml';
87
+        $path = str_replace('src', 'data', __DIR__).'/deviceModels.xml';
88 88
         $models = array();
89 89
         $xmlObj = simplexml_load_file($path);
90
-        foreach($xmlObj->children() as $rule)
90
+        foreach ($xmlObj->children() as $rule)
91 91
         {
92 92
             $models[] = new self($rule);
93 93
         }
Please login to merge, or discard this patch.
oldSrc/Result/Data.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
      */
57 57
     public function __construct(\SimpleXMLElement $xmlData)
58 58
     {
59
-        if($xmlData !== null)
59
+        if ($xmlData !== null)
60 60
         {
61 61
             foreach ($xmlData->children() as $child) {
62 62
                 switch ($child->getName()) {
Please login to merge, or discard this patch.
oldSrc/Result/Robot.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -72,19 +72,19 @@
 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
             {
79 79
                 $name = $child->getName();
80 80
                 $val = $child->__toString();
81
-                if($name != 'id' && $name != 'pattern' && $name != 'SearchEngine')
81
+                if ($name != 'id' && $name != 'pattern' && $name != 'SearchEngine')
82 82
                 {
83 83
                     $this->$name = $val;
84 84
                 }
85
-                if($name == 'SearchEngine')
85
+                if ($name == 'SearchEngine')
86 86
                 {
87
-                    if($val == 'true')
87
+                    if ($val == 'true')
88 88
                     {
89 89
                         $this->setSearchEngine(true);
90 90
                     }
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -87,9 +87,9 @@
 block discarded – undo
87 87
                     if($val == 'true')
88 88
                     {
89 89
                         $this->setSearchEngine(true);
90
+                    } else {
91
+                                            $this->setSearchEngine(false);
90 92
                     }
91
-                    else
92
-                        $this->setSearchEngine(false);
93 93
                 }
94 94
             }
95 95
         }
Please login to merge, or discard this patch.
oldSrc/Result/Device.php 2 patches
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.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,8 +43,7 @@
 block discarded – undo
43 43
 
44 44
             $this->setName('Desktop');
45 45
             $this->setType('desktop');
46
-        }
47
-        else
46
+        } else
48 47
         {
49 48
             parent::__construct($xmlData);
50 49
 
Please login to merge, or discard this patch.
oldSrc/Result/DetectorRule.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -104,13 +104,13 @@  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
             {
111 111
                 $name = $child->getName();
112 112
                 $val = $child->__toString();
113
-                if($name != 'TargetValue')
113
+                if ($name != 'TargetValue')
114 114
                 {
115 115
                     $this->$name = $val;
116 116
                 }
@@ -125,15 +125,15 @@  discard block
 block discarded – undo
125 125
      */
126 126
     public static function loadRulesFromFile()
127 127
     {
128
-        $path = str_replace('src','data',__DIR__).'/rules/';
128
+        $path = str_replace('src', 'data', __DIR__).'/rules/';
129 129
         $files = scandir($path);
130 130
         $rules = array();
131
-        foreach($files as $file)
131
+        foreach ($files as $file)
132 132
         {
133
-            if($file != '.' && $file != '..')
133
+            if ($file != '.' && $file != '..')
134 134
             {
135 135
                 $xmlObj = simplexml_load_file($path.$file);
136
-                foreach($xmlObj->children() as $rule)
136
+                foreach ($xmlObj->children() as $rule)
137 137
                 {
138 138
                     $rules[] = new self($rule);
139 139
                 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -113,9 +113,9 @@
 block discarded – undo
113 113
                 if($name != 'TargetValue')
114 114
                 {
115 115
                     $this->$name = $val;
116
+                } else {
117
+                                    $this->$name = filter_var($val, FILTER_VALIDATE_BOOLEAN);
116 118
                 }
117
-                else
118
-                    $this->$name = filter_var($val, FILTER_VALIDATE_BOOLEAN);
119 119
             }
120 120
         }
121 121
     }
Please login to merge, or discard this patch.
oldSrc/Result/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.
src/YamlLoader.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     {
38 38
         $parameters = [];
39 39
         $parser = new Parser();
40
-        $dataDir = \dirname(__DIR__) . '/var/data/';
40
+        $dataDir = \dirname(__DIR__).'/var/data/';
41 41
         foreach (new \DirectoryIterator($dataDir) as $file) {
42 42
             if ($file->getExtension() === '.yml') {
43 43
                 $data = $parser->parseFile($file->getRealPath());
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     public function getParameter(string $name): array
57 57
     {
58 58
         if (!array_key_exists($name, $this->parameters)) {
59
-            throw new DetectorException(sprintf('% not exist in data' . $name), 1);
59
+            throw new DetectorException(sprintf('% not exist in data'.$name), 1);
60 60
         }
61 61
         return $this->parameters[$name];
62 62
     }
Please login to merge, or discard this patch.