Completed
Pull Request — 4.0 (#39)
by Serhii
03:42 queued 02:28
created
src/Detector.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,6 @@
 block discarded – undo
12 12
 use EndorphinStudio\Detector\Data\AbstractData;
13 13
 use EndorphinStudio\Detector\Data\Result;
14 14
 use EndorphinStudio\Detector\Exception\StorageException;
15
-use EndorphinStudio\Detector\Storage\AbstractStorage;
16 15
 use EndorphinStudio\Detector\Storage\StorageInterface;
17 16
 use Symfony\Component\HttpFoundation\Request;
18 17
 
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -102,11 +102,11 @@  discard block
 block discarded – undo
102 102
 
103 103
         $this->init();
104 104
         $this->detectors = [];
105
-        $check = ['os','device', 'browser', 'robot'];
105
+        $check = ['os', 'device', 'browser', 'robot'];
106 106
         Tools::setWindowsConfig($this->dataProvider->getConfig()['windows']);
107 107
         foreach ($check as $detectionType) {
108 108
             $className = sprintf('\\EndorphinStudio\\Detector\\Detection\\%s', ucfirst(sprintf('%sDetector', $detectionType)));
109
-            if(class_exists($className)) {
109
+            if (class_exists($className)) {
110 110
                 $this->detectors[$detectionType] = new $className();
111 111
                 $this->detectors[$detectionType]->init($this);
112 112
             }
@@ -167,11 +167,11 @@  discard block
 block discarded – undo
167 167
     private function findDataDirectory(): string
168 168
     {
169 169
         $dataDirectory = $this->options['dataDirectory'];
170
-        if($this->options['dataDirectory'] === 'auto') {
170
+        if ($this->options['dataDirectory'] === 'auto') {
171 171
             $reflection = new \ReflectionClass(AbstractData::class);
172
-            $dataDirectory = sprintf('%s/var/%s', dirname($reflection->getFileName(),3), $this->options['format']);
172
+            $dataDirectory = sprintf('%s/var/%s', dirname($reflection->getFileName(), 3), $this->options['format']);
173 173
         }
174
-        if(is_dir($dataDirectory)){
174
+        if (is_dir($dataDirectory)) {
175 175
             return $dataDirectory;
176 176
         }
177 177
         throw new StorageException(sprintf(StorageException::DIRECTORY_NOT_FOUND, $dataDirectory));
@@ -185,11 +185,11 @@  discard block
 block discarded – undo
185 185
     private function findCacheDirectory(): string
186 186
     {
187 187
         $cacheDirectory = $this->options['dataDirectory'];
188
-        if($this->options['dataDirectory'] === 'auto') {
188
+        if ($this->options['dataDirectory'] === 'auto') {
189 189
             $reflection = new \ReflectionClass(AbstractData::class);
190
-            $cacheDirectory = sprintf('%s/var/cache', dirname($reflection->getFileName(),3));
190
+            $cacheDirectory = sprintf('%s/var/cache', dirname($reflection->getFileName(), 3));
191 191
         }
192
-        if(is_dir($cacheDirectory)){
192
+        if (is_dir($cacheDirectory)) {
193 193
             return $cacheDirectory;
194 194
         }
195 195
         throw new StorageException(sprintf(StorageException::DIRECTORY_NOT_FOUND, $cacheDirectory));
Please login to merge, or discard this patch.