After discussion with a colleague, we are mixed with the fact that, in our opinion, the logic related to opinion should go.
For example, let's say we have a number that we want to show in our opinion. I think that number_format (or CakeNumber::format , as we use CakePHP) should appear in the view as it is related to what we are showing. My colleague believes that he should go to the controller, because where all the logic goes.
In this case, we have two views: one for the website and end users, and an API view that returns a json response. If I were to put the code in the controller, I would need to check what kind I use, so as not to give a line in the json response when it really is an integer. For this reason, I strongly support the code in the view.
The question is, who is βright,β where is the formatting of numbers?
In addition to my argument about placing code in a view, he gladly uses htmlentities in the view, but I argue that if I am not allowed to number_format, it cannot have htmlentities and that it must be done in the controller.
source share