8000 Use GitHub syntax highlighting by lologhi · Pull Request #2 · symfony/routing · GitHub
[go: up one dir, main page]

Skip to content

Use GitHub syntax highlighting #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement 8000 . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Add GitHub syntax highlighting
  • Loading branch information
lologhi committed Sep 25, 2014
commit 181bb18779a91b530ff68af01cd02fb2951b3077
22 changes: 15 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,21 @@ CHANGELOG

Before:

```
```yaml
article_edit:
pattern: /article/{id}
requirements: { '_method': 'POST|PUT', '_scheme': 'https', 'id': '\d+' }
```

```xml
<route id="article_edit" pattern="/article/{id}">
<requirement key="_method">POST|PUT</requirement>
<requirement key="_scheme">https</requirement>
<requirement key="id">\d+</requirement>
</route>
```

```php
$route = new Route();
$route->setPattern('/article/{id}');
$route->setRequirement('_method', 'POST|PUT');
Expand All @@ -42,17 +46,21 @@ CHANGELOG

After:

```
```yaml
article_edit:
path: /article/{id}
methods: [POST, PUT]
schemes: https
requirements: { 'id': '\d+' }
```

```xml
<route id="article_edit" pattern="/article/{id}" methods="POST PUT" schemes="https">
<requirement key="id">\d+</requirement>
</route>
```

```php
$route = new Route();
$route->setPath('/article/{id}');
$route->setMethods(array('POST', 'PUT'));
Expand All @@ -66,7 +74,7 @@ CHANGELOG

Before:

```
```php
$rootCollection = new RouteCollection();
$subCollection = new RouteCollection();
$rootCollection->addCollection($subCollection);
Expand All @@ -75,7 +83,7 @@ CHANGELOG

After:

```
```php
$rootCollection = new RouteCollection();
$subCollection = new RouteCollection();
$subCollection->add('foo', new Route('/foo'));
Expand All @@ -85,7 +93,7 @@ CHANGELOG
Also one must call `addCollection` from the bottom to the top hierarchy.
So the correct sequence is the following (and not the reverse):

```
```php
$childCollection->->addCollection($grandchildCollection);
$rootCollection->addCollection($childCollection);
```
Expand All @@ -112,7 +120,7 @@ CHANGELOG
use-case instead.
Before: `$parentCollection->addCollection($collection, '/prefix', array(...), array(...))`
After:
```
```php
$collection->addPrefix('/prefix', array(...), array(...));
$parentCollection->addCollection($collection);
```
Expand Down Expand Up @@ -164,6 +172,6 @@ CHANGELOG
been used anyway without creating inconsistencies
* [BC BREAK] RouteCollection::remove also removes a route from parent
collections (not only from its children)
* added ConfigurableRequirementsInterface that allows to disable exceptions
* added ConfigurableRequirementsInterface that allows to disable exceptions
(and generate empty URLs instead) when generating a route with an invalid
parameter value
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Routing associates a request with the code that will convert it to a response.
The example below demonstrates how you can set up a fully working routing
system:

```php
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Matcher\UrlMatcher;
use Symfony\Component\Routing\RequestContext;
Expand All @@ -23,12 +24,15 @@ system:
$matcher = new UrlMatcher($routes, $context);

$parameters = $matcher->match('/hello');
```

Resources
---------

You can run the unit tests with the following command:

```bash
$ cd path/to/Symfony/Component/Routing/
$ composer.phar install
$ phpunit
```
0