Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\CompiledRoute;
use Symfony\Component\Routing\RouteCollection;

class ObjectsProvider
Expand All @@ -35,7 +36,7 @@ public static function getRouteCollections()
public static function getRoutes()
{
return array(
'route_1' => new Route(
'route_1' => new RouteStub(
'/hello/{name}',
array('name' => 'Joseph'),
array('name' => '[a-z]+'),
Expand All @@ -44,7 +45,7 @@ public static function getRoutes()
array('http', 'https'),
array('get', 'head')
),
'route_2' => new Route(
'route_2' => new RouteStub(
'/name/add',
array(),
array(),
Expand Down Expand Up @@ -207,3 +208,11 @@ public static function staticMethod()
{
}
}

class RouteStub extends Route
{
public function compile()
{
return new CompiledRoute('', '#PATH_REGEX#', array(), array(), '#HOST_REGEX#');
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"path": "\/hello\/{name}",
"pathRegex": "#^\/hello(?:\/(?P<name>[a-z]+))?$#s",
"pathRegex": "#PATH_REGEX#",
"host": "localhost",
"hostRegex": "#^localhost$#si",
"hostRegex": "#HOST_REGEX#",
"scheme": "http|https",
"method": "GET|HEAD",
"class": "Symfony\\Component\\Routing\\Route",
"class": "Symfony\\Bundle\\FrameworkBundle\\Tests\\Console\\Descriptor\\RouteStub",
"defaults": {
"name": "Joseph"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
- Path: /hello/{name}
- Path Regex: #^/hello(?:/(?P<name>[a-z]+))?$#s
- Path Regex: #PATH_REGEX#
- Host: localhost
- Host Regex: #^localhost$#si
- Host Regex: #HOST_REGEX#
- Scheme: http|https
- Method: GET|HEAD
- Class: Symfony\Component\Routing\Route
- Class: Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\RouteStub
- Defaults:
- `name`: Joseph
- Requirements:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<comment>Path</comment> /hello/{name}
<comment>Path Regex</comment> #^/hello(?:/(?P<name>[a-z]+))?$#s
<comment>Path Regex</comment> #PATH_REGEX#
<comment>Host</comment> localhost
<comment>Host Regex</comment> #^localhost$#si
<comment>Host Regex</comment> #HOST_REGEX#
<comment>Scheme</comment> http|https
<comment>Method</comment> GET|HEAD
<comment>Class</comment> Symfony\Component\Routing\Route
<comment>Class</comment> Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\RouteStub
<comment>Defaults</comment> name: Joseph
<comment>Requirements</comment> name: [a-z]+
<comment>Options</comment> compiler_class: Symfony\Component\Routing\RouteCompiler
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<route class="Symfony\Component\Routing\Route">
<path regex="#^/hello(?:/(?P&lt;name&gt;[a-z]+))?$#s">/hello/{name}</path>
<host regex="#^localhost$#si">localhost</host>
<route class="Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\RouteStub">
<path regex="#PATH_REGEX#">/hello/{name}</path>
<host regex="#HOST_REGEX#">localhost</host>
<scheme>http</scheme>
<scheme>https</scheme>
<method>GET</method>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"path": "\/name\/add",
"pathRegex": "#^\/name\/add$#s",
"pathRegex": "#PATH_REGEX#",
"host": "localhost",
"hostRegex": "#^localhost$#si",
"hostRegex": "#HOST_REGEX#",
"scheme": "http|https",
"method": "PUT|POST",
"class": "Symfony\\Component\\Routing\\Route",
"class": "Symfony\\Bundle\\FrameworkBundle\\Tests\\Console\\Descriptor\\RouteStub",
"defaults": [],
"requirements": "NO CUSTOM",
"options": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
- Path: /name/add
- Path Regex: #^/name/add$#s
- Path Regex: #PATH_REGEX#
- Host: localhost
- Host Regex: #^localhost$#si
- Host Regex: #HOST_REGEX#
- Scheme: http|https
- Method: PUT|POST
- Class: Symfony\Component\Routing\Route
- Class: Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\RouteStub
- Defaults: NONE
- Requirements: NO CUSTOM
- Options:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<comment>Path</comment> /name/add
<comment>Path Regex</comment> #^/name/add$#s
<comment>Path Regex</comment> #PATH_REGEX#
<comment>Host</comment> localhost
<comment>Host Regex</comment> #^localhost$#si
<comment>Host Regex</comment> #HOST_REGEX#
<comment>Scheme</comment> http|https
<comment>Method</comment> PUT|POST
<comment>Class</comment> Symfony\Component\Routing\Route
<comment>Class</comment> Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\RouteStub
<comment>Defaults</comment> NONE
<comment>Requirements</comment> NO CUSTOM
<comment>Options</comment> compiler_class: Symfony\Component\Routing\RouteCompiler
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<route class="Symfony\Component\Routing\Route">
<path regex="#^/name/add$#s">/name/add</path>
<host regex="#^localhost$#si">localhost</host>
<route class="Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\RouteStub">
<path regex="#PATH_REGEX#">/name/add</path>
<host regex="#HOST_REGEX#">localhost</host>
<scheme>http</scheme>
<scheme>https</scheme>
<method>PUT</method>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"route_1": {
"path": "\/hello\/{name}",
"pathRegex": "#^\/hello(?:\/(?P<name>[a-z]+))?$#s",
"pathRegex": "#PATH_REGEX#",
"host": "localhost",
"hostRegex": "#^localhost$#si",
"hostRegex": "#HOST_REGEX#",
"scheme": "http|https",
"method": "GET|HEAD",
"class": "Symfony\\Component\\Routing\\Route",
"class": "Symfony\\Bundle\\FrameworkBundle\\Tests\\Console\\Descriptor\\RouteStub",
"defaults": {
"name": "Joseph"
},
Expand All @@ -21,12 +21,12 @@
},
"route_2": {
"path": "\/name\/add",
"pathRegex": "#^\/name\/add$#s",
"pathRegex": "#PATH_REGEX#",
"host": "localhost",
"hostRegex": "#^localhost$#si",
"hostRegex": "#HOST_REGEX#",
"scheme": "http|https",
"method": "PUT|POST",
"class": "Symfony\\Component\\Routing\\Route",
"class": "Symfony\\Bundle\\FrameworkBundle\\Tests\\Console\\Descriptor\\RouteStub",
"defaults": [],
"requirements": "NO CUSTOM",
"options": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ route_1
-------

- Path: /hello/{name}
- Path Regex: #^/hello(?:/(?P<name>[a-z]+))?$#s
- Path Regex: #PATH_REGEX#
- Host: localhost
- Host Regex: #^localhost$#si
- Host Regex: #HOST_REGEX#
- Scheme: http|https
- Method: GET|HEAD
- Class: Symfony\Component\Routing\Route
- Class: Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\RouteStub
- Defaults:
- `name`: Joseph
- Requirements:
Expand All @@ -22,12 +22,12 @@ route_2
-------

- Path: /name/add
- Path Regex: #^/name/add$#s
- Path Regex: #PATH_REGEX#
- Host: localhost
- Host Regex: #^localhost$#si
- Host Regex: #HOST_REGEX#
- Scheme: http|https
- Method: PUT|POST
- Class: Symfony\Component\Routing\Route
- Class: Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\RouteStub
- Defaults: NONE
- Requirements: NO CUSTOM
- Options:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<routes>
<route name="route_1" class="Symfony\Component\Routing\Route">
<path regex="#^/hello(?:/(?P&lt;name&gt;[a-z]+))?$#s">/hello/{name}</path>
<host regex="#^localhost$#si">localhost</host>
<route name="route_1" class="Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\RouteStub">
<path regex="#PATH_REGEX#">/hello/{name}</path>
<host regex="#HOST_REGEX#">localhost</host>
<scheme>http</scheme>
<scheme>https</scheme>
<method>GET</method>
Expand All @@ -19,9 +19,9 @@
<option key="opt2">val2</option>
</options>
</route>
<route name="route_2" class="Symfony\Component\Routing\Route">
<path regex="#^/name/add$#s">/name/add</path>
<host regex="#^localhost$#si">localhost</host>
<route name="route_2" class="Symfony\Bundle\FrameworkBundle\Tests\Console\Descriptor\RouteStub">
<path regex="#PATH_REGEX#">/name/add</path>
<host regex="#HOST_REGEX#">localhost</host>
<scheme>http</scheme>
<scheme>https</scheme>
<method>PUT</method>
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Routing/RouteCompiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ private static function compilePattern(Route $route, $pattern, $isHost)

return array(
'staticPrefix' => 'text' === $tokens[0][0] ? $tokens[0][1] : '',
'regex' => self::REGEX_DELIMITER.'^'.$regexp.'$'.self::REGEX_DELIMITER.'s'.($isHost ? 'i' : ''),
'regex' => self::REGEX_DELIMITER.'^'.$regexp.'$'.self::REGEX_DELIMITER.'sD'.($isHost ? 'i' : ''),
'tokens' => array_reverse($tokens),
'variables' => $variables,
);
Expand Down
Loading