readability fixes in chapters 7 and 9

This commit is contained in:
lubiana 2022-05-02 08:39:48 +02:00 committed by Andre Lubian
parent 44c5e06996
commit 8f7d95d86f
2 changed files with 3 additions and 3 deletions

View file

@ -12,7 +12,7 @@ So forget about MVC and instead let's worry about [separation of concerns](http:
We will need a descriptive name for the classes that handle the requests. For this tutorial I will use `Handler`, other We will need a descriptive name for the classes that handle the requests. For this tutorial I will use `Handler`, other
common names are 'Controllers' or 'Actions'. common names are 'Controllers' or 'Actions'.
Create a new folder inside the `src/` folder with the name `Handler`.In this folder we will place all our action classes. Create a new folder inside the `src/` folder with the name `Action`. In this folder we will place all our action classes.
In there, create a `Hello.php` file. In there, create a `Hello.php` file.
```php ```php
@ -36,7 +36,7 @@ You can see that we implement the [RequestHandlerInterface](https://github.com/p
that has a 'handle'-Method with requires a Requestobject as its parameter and returns a Responseobject. For now this is that has a 'handle'-Method with requires a Requestobject as its parameter and returns a Responseobject. For now this is
fine, but we may have to change our approach later. In anyway it is good to know about this interface as we will implement fine, but we may have to change our approach later. In anyway it is good to know about this interface as we will implement
it in some other parts of our application as well. In order to use that Interface we have to require it with composer: it in some other parts of our application as well. In order to use that Interface we have to require it with composer:
'composer require psr/http-server-handler'. `composer require psr/http-server-handler`.
The autoloader will only work if the namespace of a class matches the file path and the file name equals the class name. The autoloader will only work if the namespace of a class matches the file path and the file name equals the class name.
At the beginning I defined `Lubian\NoFramework` as the root namespace of the application so this is referring to the `src/` folder. At the beginning I defined `Lubian\NoFramework` as the root namespace of the application so this is referring to the `src/` folder.

View file

@ -12,7 +12,7 @@ for a [suitable solution on packagist](https://packagist.org/providers/psr/conta
I choose the [PHP-DI](https://packagist.org/packages/php-di/php-di) container, as it is easy to configure and provides some very [powerfull features](https://php-di.org/#autowiring) I choose the [PHP-DI](https://packagist.org/packages/php-di/php-di) container, as it is easy to configure and provides some very [powerfull features](https://php-di.org/#autowiring)
out of the box. out of the box.
After installing the container through composer create a new file with the name 'dependencies.php' in your config folder: After installing the container through composer create a new file with the name `dependencies.php` in your config folder:
```php ```php
<?php declare(strict_types = 1); <?php declare(strict_types = 1);