Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7101893

Browse filesBrowse files
[Routing] rename Route::getLocales() to Route::getLocalizedPaths()
1 parent 5e52160 commit 7101893
Copy full SHA for 7101893

File tree

3 files changed

+15
-15
lines changed
Filter options

3 files changed

+15
-15
lines changed

‎src/Symfony/Component/Routing/Annotation/Route.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Routing/Annotation/Route.php
+9-9Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
class Route
2323
{
2424
private $path;
25-
private $locales = array();
25+
private $localizedPaths = array();
2626
private $name;
2727
private $requirements = array();
2828
private $options = array();
@@ -39,17 +39,17 @@ class Route
3939
*/
4040
public function __construct(array $data)
4141
{
42-
if (isset($data['locales'])) {
43-
throw new \BadMethodCallException(sprintf('Unknown property "locales" on annotation "%s".', get_class($this)));
42+
if (isset($data['localized_paths'])) {
43+
throw new \BadMethodCallException(sprintf('Unknown property "localized_paths" on annotation "%s".', get_class($this)));
4444
}
4545

4646
if (isset($data['value'])) {
47-
$data[is_array($data['value']) ? 'locales' : 'path'] = $data['value'];
47+
$data[is_array($data['value']) ? 'localized_paths' : 'path'] = $data['value'];
4848
unset($data['value']);
4949
}
5050

5151
if (isset($data['path']) && is_array($data['path'])) {
52-
$data['locales'] = $data['path'];
52+
$data['localized_paths'] = $data['path'];
5353
unset($data['path']);
5454
}
5555

@@ -72,14 +72,14 @@ public function getPath()
7272
return $this->path;
7373
}
7474

75-
public function setLocales(array $locales)
75+
public function setLocalizedPaths(array $localizedPaths)
7676
{
77-
$this->locales = $locales;
77+
$this->localizedPaths = $localizedPaths;
7878
}
7979

80-
public function getLocales(): array
80+
public function getLocalizedPaths(): array
8181
{
82-
return $this->locales;
82+
return $this->localizedPaths;
8383
}
8484

8585
public function setHost($pattern)

‎src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public function load($class, $type = null)
124124
if (0 === $collection->count() && $class->hasMethod('__invoke') && $annot = $this->reader->getClassAnnotation($class, $this->routeAnnotationClass)) {
125125
$globals['path'] = null;
126126
$globals['name'] = '';
127-
$globals['locales'] = array();
127+
$globals['localized_paths'] = array();
128128
$this->addRoute($collection, $annot, $globals, $class, $class->getMethod('__invoke'));
129129
}
130130

@@ -155,8 +155,8 @@ protected function addRoute(RouteCollection $collection, $annot, $globals, \Refl
155155
$condition = $globals['condition'];
156156
}
157157

158-
$path = $annot->getLocales() ?: $annot->getPath();
159-
$prefix = $globals['locales'] ?: $globals['path'];
158+
$path = $annot->getLocalizedPaths() ?: $annot->getPath();
159+
$prefix = $globals['localized_paths'] ?: $globals['path'];
160160
$paths = array();
161161

162162
if (\is_array($path)) {
@@ -253,7 +253,7 @@ protected function getGlobals(\ReflectionClass $class)
253253
{
254254
$globals = array(
255255
'path' => null,
256-
'locales' => array(),
256+
'localized_paths' => array(),
257257
'requirements' => array(),
258258
'options' => array(),
259259
'defaults' => array(),
@@ -273,7 +273,7 @@ protected function getGlobals(\ReflectionClass $class)
273273
$globals['path'] = $annot->getPath();
274274
}
275275

276-
$globals['locales'] = $annot->getLocales();
276+
$globals['localized_paths'] = $annot->getLocalizedPaths();
277277

278278
if (null !== $annot->getRequirements()) {
279279
$globals['requirements'] = $annot->getRequirements();

‎src/Symfony/Component/Routing/Tests/Annotation/RouteTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Routing/Tests/Annotation/RouteTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function getValidParameters()
5353
array('methods', array('GET', 'POST'), 'getMethods'),
5454
array('host', '{locale}.example.com', 'getHost'),
5555
array('condition', 'context.getMethod() == "GET"', 'getCondition'),
56-
array('value', array('nl' => '/hier', 'en' => '/here'), 'getLocales'),
56+
array('value', array('nl' => '/hier', 'en' => '/here'), 'getLocalizedPaths'),
5757
);
5858
}
5959
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.