@@ -3,8 +3,8 @@ Create your own framework... on top of the Symfony2 Components (part 12)
3
3
4
4
In the last installment of this series, we have emptied the
5
5
``Simplex\\Framework `` class by extending the ``HttpKernel `` class from
6
- Symfony . Seeing this empty class, you might be tempted to move some code from
7
- the front controller to it::
6
+ the eponymous component . Seeing this empty class, you might be tempted to move
7
+ some code from the front controller to it::
8
8
9
9
<?php
10
10
@@ -50,7 +50,7 @@ The front controller code would become more concise::
50
50
51
51
$framework->handle($request)->send();
52
52
53
- Having a more concise front controller means that you can have more than one
53
+ Having a concise front controller allows you to have several front controllers
54
54
for a single application. Why would it be useful? To allow having different
55
55
configuration for the development environment and the production one for
56
56
instance. In the development environment, you might want to have error
@@ -78,16 +78,20 @@ issues:
78
78
* Related to the previous point, we cannot test our framework easily anymore
79
79
as it's impossible to mock internal objects;
80
80
81
- * We cannot change the charset passed to ResponseListener anymore (a
81
+ * We cannot change the charset passed to `` ResponseListener `` anymore (a
82
82
workaround could be to pass it as a constructor argument).
83
83
84
84
The previous code did not exhibit the same issues because we used dependency
85
85
injection; all dependencies of our objects were injected into their
86
- constructors (for instance, the event dispatcher were injected into the
86
+ constructors (for instance, the event dispatchers were injected into the
87
87
framework so that we had total control of its creation and configuration).
88
88
89
- Does it means that we have to make a choice between flexibility,
89
+ Does it mean that we have to make a choice between flexibility,
90
+ <<<<<<< .merge_file_8XJJxl
90
91
customization, ease of testing and not having to copy and paste the same code
92
+ =======
93
+ customization, ease of testing and not to copy and paste the same code
94
+ >>>>>>> .merge_file_kv38Yk
91
95
into each application front controller? As you might expect, there is a
92
96
solution. We can solve all these issues and some more by using the Symfony2
93
97
dependency injection container:
@@ -249,7 +253,7 @@ Have fun!
249
253
250
254
*P.S.: * If there is enough interest (leave a comment on this post), I might
251
255
write some more articles on specific topics (using a configuration file for
252
- routing, using HttpKernel debugging tools, using the build -in client to
256
+ routing, using HttpKernel debugging tools, using the built -in client to
253
257
simulate a browser are some of the topics that come to my mind for instance).
254
258
255
259
.. _`Pimple` : https://github.com/fabpot/Pimple
0 commit comments