Ask if php's method body is too long. is it necessary to split and encapsulate it? if a method body is too long, is it necessary to split several internal functions and encapsulate the call? the premise is that the encapsulated method will not be reused. ------ solution ------------------ The problem is that the code is inconvenient to view, so I may split it several functional module files include. if you call these details elsewhere, it is necessary to split them into other units. this is my personal practice. --- is it necessary to split and encapsulate the php method too long?
If a method is too long, is it necessary to split several internal functions and encapsulate the call?
The premise is that the encapsulated method will not be reused.
------ Solution --------------------
The long problem is that it is inconvenient to view the code.
So I may split it into several functional module files: include.
If you call these details elsewhere, it is necessary to split them into other units.
This is my personal practice.
------ Solution --------------------
How many functions does one method need to complete? Obviously, it is to be split.
A function is a function. if there are several functions, there should be several functions.
At this point, there is no country difference
------ Solution --------------------
This can also be considered to have little to do with reuse. You divide long functions into several functions. It is easy to read and make it clear to others. In addition, you only need to modify it in a specific part. And mvc.
------ Solution --------------------
The encapsulated structure is clearer. Add comments. So that the maintenance will not be dizzy ..