Completed
Pull Request — 4.0 (#39)
by Serhii
02:29 queued 01:15
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
             }
@@ -165,11 +165,11 @@  discard block
 block discarded – undo
165 165
     private function findDataDirectory(): string
166 166
     {
167 167
         $dataDirectory = $this->options['dataDirectory'];
168
-        if($this->options['dataDirectory'] === 'auto') {
168
+        if ($this->options['dataDirectory'] === 'auto') {
169 169
             $reflection = new \ReflectionClass(AbstractData::class);
170
-            $dataDirectory = sprintf('%s/var/%s', dirname($reflection->getFileName(),3), $this->options['format']);
170
+            $dataDirectory = sprintf('%s/var/%s', dirname($reflection->getFileName(), 3), $this->options['format']);
171 171
         }
172
-        if(is_dir($dataDirectory)){
172
+        if (is_dir($dataDirectory)) {
173 173
             return $dataDirectory;
174 174
         }
175 175
         throw new StorageException(sprintf(StorageException::DIRECTORY_NOT_FOUND, $dataDirectory));
@@ -183,11 +183,11 @@  discard block
 block discarded – undo
183 183
     private function findCacheDirectory(): string
184 184
     {
185 185
         $cacheDirectory = $this->options['cacheDirectory'];
186
-        if($this->options['cacheDirectory'] === 'auto') {
186
+        if ($this->options['cacheDirectory'] === 'auto') {
187 187
             $reflection = new \ReflectionClass(AbstractData::class);
188
-            $cacheDirectory = sprintf('%s/var/cache', dirname($reflection->getFileName(),3));
188
+            $cacheDirectory = sprintf('%s/var/cache', dirname($reflection->getFileName(), 3));
189 189
         }
190
-        if(is_dir($cacheDirectory)){
190
+        if (is_dir($cacheDirectory)) {
191 191
             return $cacheDirectory;
192 192
         }
193 193
         throw new StorageException(sprintf(StorageException::DIRECTORY_NOT_FOUND, $cacheDirectory));
Please login to merge, or discard this patch.