Skip to content

Navigation Menu

Sign in
Appearance settings

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 56b6e31

Browse filesBrowse files
alamiraultjaviereguiluz
authored andcommitted
Update Create Framework tutorial
1 parent 8b20cc8 commit 56b6e31
Copy full SHA for 56b6e31

5 files changed

+4
-14
lines changed

‎create_framework/dependency_injection.rst

Copy file name to clipboardExpand all lines: create_framework/dependency_injection.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ to it::
1010
namespace Simplex;
1111

1212
use Symfony\Component\EventDispatcher\EventDispatcher;
13-
use Symfony\Component\HttpFoundation;
1413
use Symfony\Component\HttpFoundation\RequestStack;
1514
use Symfony\Component\HttpKernel;
1615
use Symfony\Component\Routing;
@@ -199,6 +198,7 @@ Now, here is how you can register a custom listener in the front controller::
199198

200199
// ...
201200
use Simplex\StringResponseListener;
201+
use Symfony\Component\DependencyInjection\Reference;
202202

203203
$container->register('listener.string_response', StringResponseListener::class);
204204
$container->getDefinition('dispatcher')

‎create_framework/event_dispatcher.rst

Copy file name to clipboardExpand all lines: create_framework/event_dispatcher.rst
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ the registration of a listener for the ``response`` event::
121121
$response = $event->getResponse();
122122

123123
if ($response->isRedirection()
124-
|| ($response->headers->has('Content-Type') && false === strpos($response->headers->get('Content-Type'), 'html'))
124+
|| ($response->headers->has('Content-Type') && !str_contains($response->headers->get('Content-Type'), 'html'))
125125
|| 'html' !== $event->getRequest()->getRequestFormat()
126126
) {
127127
return;
@@ -200,7 +200,7 @@ Let's refactor the code a bit by moving the Google listener to its own class::
200200
$response = $event->getResponse();
201201

202202
if ($response->isRedirection()
203-
|| ($response->headers->has('Content-Type') && false === strpos($response->headers->get('Content-Type'), 'html'))
203+
|| ($response->headers->has('Content-Type') && !str_contains($response->headers->get('Content-Type'), 'html'))
204204
|| 'html' !== $event->getRequest()->getRequestFormat()
205205
) {
206206
return;

‎create_framework/http_foundation.rst

Copy file name to clipboardExpand all lines: create_framework/http_foundation.rst
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ fingertips thanks to a nice and simple API::
189189
// retrieves a COOKIE value
190190
$request->cookies->get('PHPSESSID');
191191

192-
// retrieves a HTTP request header, with normalized, lowercase keys
192+
// retrieves an HTTP request header, with normalized, lowercase keys
193193
$request->headers->get('host');
194194
$request->headers->get('content-type');
195195

‎create_framework/http_kernel_controller_resolver.rst

Copy file name to clipboardExpand all lines: create_framework/http_kernel_controller_resolver.rst
-9Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -165,15 +165,6 @@ Let's conclude with the new version of our framework::
165165
use Symfony\Component\HttpKernel;
166166
use Symfony\Component\Routing;
167167

168-
function render_template(Request $request): Response
169-
{
170-
extract($request->attributes->all(), EXTR_SKIP);
171-
ob_start();
172-
include sprintf(__DIR__.'/../src/pages/%s.php', $_route);
173-
174-
return new Response(ob_get_clean());
175-
}
176-
177168
$request = Request::createFromGlobals();
178169
$routes = include __DIR__.'/../src/app.php';
179170

‎create_framework/http_kernel_httpkernel_class.rst

Copy file name to clipboardExpand all lines: create_framework/http_kernel_httpkernel_class.rst
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ And the new front controller::
3939
use Symfony\Component\EventDispatcher\EventDispatcher;
4040
use Symfony\Component\HttpFoundation\Request;
4141
use Symfony\Component\HttpFoundation\RequestStack;
42-
use Symfony\Component\HttpFoundation\Response;
4342
use Symfony\Component\HttpKernel;
4443
use Symfony\Component\Routing;
4544

0 commit comments

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