Skip to content

Commit eb8036b

Browse files
committed
Rename $locale property to $full
1 parent d92b949 commit eb8036b

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

src/BrowserLocale.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function getLocale()
4141
* If a property filter is specified, a flattened array of locale information,
4242
* containing only the requested property values will be returned instead.
4343
*
44-
* @param string $propertyFilter locale|language|country|weight
44+
* @param string $propertyFilter full|language|country|weight
4545
*
4646
* @return array
4747
*/
@@ -94,7 +94,7 @@ protected function parseAcceptLanguage($httpAcceptLanguage)
9494

9595
if ($locale !== null) {
9696
$localeInstance = new Locale();
97-
$localeInstance->locale = $locale;
97+
$localeInstance->full = $locale;
9898
$localeInstance->language = $this->getLanguage($locale);
9999
$localeInstance->country = $this->getCountry($locale);
100100
$localeInstance->weight = $this->getWeight($weight);
@@ -210,7 +210,7 @@ protected function sortLocales()
210210
*/
211211
protected function filterLocaleInfo($property)
212212
{
213-
$filters = ['locale', 'language', 'country', 'weight'];
213+
$filters = ['full', 'language', 'country', 'weight'];
214214
$locales = $this->locales;
215215

216216
if ( ! in_array($property, $filters)) {

src/Locale.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Locale
99
*
1010
* @var string
1111
*/
12-
public $locale;
12+
public $full;
1313

1414
/**
1515
* Language code of the locale.

tests/BrowserLocaleTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public function it_returns_the_most_preferred_locale()
1313
$browser = new BrowserLocale('en-US,en;q=0.8,nl-NL;q=0.6,nl;q=0.4');
1414
$locale = $browser->getLocale();
1515

16-
$this->assertEquals('en-US', $locale->locale);
16+
$this->assertEquals('en-US', $locale->full);
1717
$this->assertEquals('en', $locale->language);
1818
$this->assertEquals('US', $locale->country);
1919
$this->assertEquals(1.0, $locale->weight);
@@ -25,7 +25,7 @@ public function it_returns_the_first_locale_if_two_have_the_same_weight()
2525
$browser = new BrowserLocale('nl-NL,en-US,nl;q=0.4');
2626
$locale = $browser->getLocale();
2727

28-
$this->assertEquals('nl-NL', $locale->locale);
28+
$this->assertEquals('nl-NL', $locale->full);
2929
$this->assertEquals('nl', $locale->language);
3030
$this->assertEquals('NL', $locale->country);
3131
$this->assertEquals(1.0, $locale->weight);
@@ -37,33 +37,33 @@ public function it_returns_an_array_of_all_preferred_locales()
3737
$browser = new BrowserLocale('en-US,en;q=0.8,nl-NL;q=0.6,nl;q=0.4');
3838
$locales = $browser->getLocales();
3939

40-
$this->assertEquals('en-US', $locales[0]->locale);
40+
$this->assertEquals('en-US', $locales[0]->full);
4141
$this->assertEquals('en', $locales[0]->language);
4242
$this->assertEquals('US', $locales[0]->country);
4343
$this->assertEquals(1.0, $locales[0]->weight);
4444

45-
$this->assertEquals('en', $locales[1]->locale);
45+
$this->assertEquals('en', $locales[1]->full);
4646
$this->assertEquals('en', $locales[1]->language);
4747
$this->assertEquals('', $locales[1]->country);
4848
$this->assertEquals(0.8, $locales[1]->weight);
4949

50-
$this->assertEquals('nl-NL', $locales[2]->locale);
50+
$this->assertEquals('nl-NL', $locales[2]->full);
5151
$this->assertEquals('nl', $locales[2]->language);
5252
$this->assertEquals('NL', $locales[2]->country);
5353
$this->assertEquals(0.6, $locales[2]->weight);
5454

55-
$this->assertEquals('nl', $locales[3]->locale);
55+
$this->assertEquals('nl', $locales[3]->full);
5656
$this->assertEquals('nl', $locales[3]->language);
5757
$this->assertEquals('', $locales[3]->country);
5858
$this->assertEquals(0.4, $locales[3]->weight);
5959
}
6060

6161
/** @test */
62-
public function it_returns_a_simple_array_of_locales()
62+
public function it_returns_a_simple_array_of_full_locales()
6363
{
6464
$browser = new BrowserLocale('en-US,en;q=0.8,nl-NL;q=0.6,nl;q=0.4');
6565

66-
$locales = $browser->getLocales('locale');
66+
$locales = $browser->getLocales('full');
6767

6868
$this->assertEquals(['en-US', 'en', 'nl-NL', 'nl'], $locales);
6969
}
@@ -105,7 +105,7 @@ public function it_returns_null_or_an_empty_array_if_no_locale_exists()
105105

106106
$this->assertEquals(null, $browser->getLocale());
107107
$this->assertEquals([], $browser->getLocales());
108-
$this->assertEquals([], $browser->getLocales('locales'));
108+
$this->assertEquals([], $browser->getLocales('full'));
109109
$this->assertEquals([], $browser->getLocales('language'));
110110
$this->assertEquals([], $browser->getLocales('country'));
111111
$this->assertEquals([], $browser->getLocales('weight'));

0 commit comments

Comments
 (0)