@@ -35,7 +35,7 @@ public function __construct($httpAcceptLanguages)
35
35
/**
36
36
* Get the most preferred locale.
37
37
*
38
- * @return Locale|null
38
+ * @return \CodeZero\BrowserLocale\ Locale|null
39
39
*/
40
40
public function getLocale ()
41
41
{
@@ -88,25 +88,25 @@ protected function parseAcceptLanguages($httpAcceptLanguages)
88
88
*
89
89
* @param string $httpAcceptLanguage
90
90
*
91
- * @return Locale|null
91
+ * @return \CodeZero\BrowserLocale\ Locale|null
92
92
*/
93
93
protected function parseAcceptLanguage ($ httpAcceptLanguage )
94
94
{
95
95
$ parts = $ this ->splitAcceptLanguage ($ httpAcceptLanguage );
96
96
97
- $ locale = isset ( $ parts [0 ]) ? $ parts [ 0 ] : null ;
98
- $ weight = isset ( $ parts [1 ]) ? $ parts [ 1 ] : null ;
97
+ $ locale = $ parts [0 ] ?? null ;
98
+ $ weight = $ parts [1 ] ?? null ;
99
99
100
- $ localeInstance = null ;
101
-
102
- if ($ locale !== null ) {
103
- $ localeInstance = new Locale ();
104
- $ localeInstance ->full = $ locale ;
105
- $ localeInstance ->language = $ this ->getLanguage ($ locale );
106
- $ localeInstance ->country = $ this ->getCountry ($ locale );
107
- $ localeInstance ->weight = $ this ->getWeight ($ weight );
100
+ if ($ locale === null ) {
101
+ return null ;
108
102
}
109
103
104
+ $ localeInstance = new Locale ();
105
+ $ localeInstance ->full = $ locale ;
106
+ $ localeInstance ->language = $ this ->getLanguage ($ locale );
107
+ $ localeInstance ->country = $ this ->getCountry ($ locale );
108
+ $ localeInstance ->weight = $ this ->getWeight ($ weight );
109
+
110
110
return $ localeInstance ;
111
111
}
112
112
0 commit comments