Question:
The method size is 22 lines. (20 Allowed)
NetBeans gives me this "warning", so why? Is it a PHP rule?
What's better:
- A big method with all the code it needs.
- Split this code into smaller methods
- Is there an adequate number of lines in a method?
Answer:
This is a netbeans suggestion that there is no line or character limit for a method. The ideal is that he solves only one problem, that is, he has only one responsibility.
1) A big method with all the code it needs.
In this situation there is a great possibility that the method is doing several things.
2) Split this code into smaller methods
In some cases it is the best solution.
3) Is there an adequate number of lines in a method?
Do not.