Posted on Sep14th2021 by Matthias Noback The input is an HTTP request, which is a plain-text message that gets passed to the web server, the PHP server, the framework, and finally a user-land controller. The output is an HTTP response, which is also a plain-text message that gets passed to the client.
The next step is to ensure it's of the correct type, and optionally cast it to the correct type: From the type signature if $record, it's not clear that we may expect keys title and numberOfComments to exist.
However, I generally put them inside a trait and call it, for example, Mapping: Using a trait for this is nice, because it doesn't add methods to the public interface of the class where you use the trait.