Passed
Push — master ( bb74df...01777c )
by Jakub
02:24
created
src/Bridges/NetteApplication/ParamLocaleResolver.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace Nexendrie\Translation\Bridges\NetteApplication;
5 5
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
   /**
40 40
    * Resolve language
41 41
    */
42
-  public function resolve(): ?string {
42
+  public function resolve(): ? string {
43 43
     if(!is_null($this->request)) {
44 44
       return $this->request->getParameter($this->param);
45 45
     }
Please login to merge, or discard this patch.
src/Resolvers/SessionLocaleResolver.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace Nexendrie\Translation\Resolvers;
5 5
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
     $this->section = $session->getSection(get_class($this));
36 36
   }
37 37
   
38
-  public function getLang(): ?string {
38
+  public function getLang(): ? string {
39 39
     if(empty($this->section->{$this->varName})) {
40 40
       return NULL;
41 41
     }
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
   /**
58 58
    * Resolve language
59 59
    */
60
-  public function resolve(): ?string {
60
+  public function resolve(): ? string {
61 61
     return $this->getLang();
62 62
   }
63 63
 }
Please login to merge, or discard this patch.
src/Resolvers/FallbackLocaleResolver.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace Nexendrie\Translation\Resolvers;
5 5
 
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
    *
19 19
    * @return NULL
20 20
    */
21
-  public function resolve(): ?string {
21
+  public function resolve(): ? string {
22 22
     return NULL;
23 23
   }
24 24
 }
Please login to merge, or discard this patch.
src/Resolvers/ChainLocaleResolver.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace Nexendrie\Translation\Resolvers;
5 5
 
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
     $this[] = $resolver;
22 22
   }
23 23
   
24
-  public function resolve(): ?string {
24
+  public function resolve(): ? string {
25 25
     foreach($this as $resolver) {
26 26
       $lang = $resolver->resolve();
27 27
       if(!is_null($lang)) {
Please login to merge, or discard this patch.
src/Resolvers/ManualLocaleResolver.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace Nexendrie\Translation\Resolvers;
5 5
 
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
   /** @var string|NULL */
17 17
   protected $lang = NULL;
18 18
   
19
-  public function getLang(): ?string {
19
+  public function getLang(): ? string {
20 20
     return $this->lang;
21 21
   }
22 22
   
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     $this->lang = $lang;
25 25
   }
26 26
   
27
-  public function resolve(): ?string {
27
+  public function resolve(): ? string {
28 28
     return $this->getLang();
29 29
   }
30 30
 }
Please login to merge, or discard this patch.
src/Resolvers/HeaderLocaleResolver.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace Nexendrie\Translation\Resolvers;
5 5
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
    * Taken from Nette\Http\Request::detectLanguage()
39 39
    * @author David Grudl
40 40
    */
41
-  public function resolve(): ?string {
41
+  public function resolve(): ? string {
42 42
     if(is_null($this->loader)) {
43 43
       throw new LoaderNotSetException("Loader is not available, cannot detect possible languages.");
44 44
     }
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
     if(is_null($header)) {
48 48
       return NULL;
49 49
     }
50
-    $s = strtolower($header);  // case insensitive
51
-    $s = strtr($s, '_', '-');  // cs_CZ means cs-CZ
52
-    rsort($langs);             // first more specific
50
+    $s = strtolower($header); // case insensitive
51
+    $s = strtr($s, '_', '-'); // cs_CZ means cs-CZ
52
+    rsort($langs); // first more specific
53 53
     $pattern = ')(?:-[^\s,;=]+)?\s*(?:;\s*q=([0-9.]+))?#';
54 54
     preg_match_all('#(' . implode('|', $langs) . $pattern, $s, $matches);
55 55
     if(!$matches[0]) {
Please login to merge, or discard this patch.
src/Resolvers/EnvironmentLocaleResolver.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-declare(strict_types=1);
2
+declare(strict_types = 1);
3 3
 
4 4
 namespace Nexendrie\Translation\Resolvers;
5 5
 
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
   /** @var string */
18 18
   protected $varName = "TRANSLATOR_LANGUAGE";
19 19
   
20
-  public function getLang(): ?string {
20
+  public function getLang(): ? string {
21 21
     $lang = getenv($this->varName);
22 22
     if($lang) {
23 23
       return $lang;
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     $this->varName = $varName;
38 38
   }
39 39
   
40
-  public function resolve(): ?string {
40
+  public function resolve(): ? string {
41 41
     return $this->getLang();
42 42
   }
43 43
 }
Please login to merge, or discard this patch.