Completed
Push — master ( 527efe...c8c92c )
by Toni
02:56
created
src/Context/RawMultilingualContext.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -70,15 +70,13 @@  discard block
 block discarded – undo
70 70
 
71 71
         if(isset($element)) {
72 72
             $text = $element->getValue();
73
-        }
74
-        else {
73
+        } else {
75 74
             throw new \Exception(sprintf("Element is null"));
76 75
         }
77 76
 
78 77
         if($text === $value) {
79 78
             return true;
80
-        }
81
-        else {
79
+        } else {
82 80
             throw new \Exception(sprintf('Value of input : "%s" does not match the text "%s"', $text, $value));
83 81
         }
84 82
     }
@@ -92,8 +90,7 @@  discard block
 block discarded – undo
92 90
                 $this->iShouldSeeInTheSourceOfThePage($text);
93 91
                 $isTextFound = true;
94 92
                 break;
95
-            }
96
-            catch (\Exception $e) {
93
+            } catch (\Exception $e) {
97 94
                 sleep(1);
98 95
             }
99 96
         }
Please login to merge, or discard this patch.
src/Context/MultilingualContext.php 1 patch
Braces   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
 
82 82
         if(in_array($clean_url_language_code,$this->languages_iso_codes)) {
83 83
             return $clean_url_language_code;
84
-        }
85
-        else if (in_array($not_clean_url_language_code,$this->languages_iso_codes)){
84
+        } else if (in_array($not_clean_url_language_code,$this->languages_iso_codes)){
86 85
             return $not_clean_url_language_code;
86
+        } else {
87
+            return $this->multilingual_parameters['default_language'];
87 88
         }
88
-        else return $this->multilingual_parameters['default_language'];
89 89
     }
90 90
 
91 91
     /**
@@ -100,11 +100,11 @@  discard block
 block discarded – undo
100 100
         if(isset($this->translations[$target][$this->multilingual_parameters['default_language']])){
101 101
             $target = $this->translations[$target][$this->languageDetection()];
102 102
             return $target;
103
-        }
104
-        elseif (isset($this->translations[$target])) {
103
+        } elseif (isset($this->translations[$target])) {
105 104
             return $target;
105
+        } else {
106
+            throw new \Exception ("The text '$target'' is not defined in '$translations' translation file.");
106 107
         }
107
-        else throw new \Exception ("The text '$target'' is not defined in '$translations' translation file.");
108 108
     }
109 109
 
110 110
     /**
Please login to merge, or discard this patch.