I taken over site from another developer, he was putting everything in functions inside class files.
e.g. page lists system users our_users.php
$users = $object_user -> get_users_list();
and function get_users_list() is NOT used anywhere else on website.
Does that make sny sense to to do it this way?
I’d personally would not even create function and just put code from inside function get_users_list() in our_users.php since its only used once anyway.
One of the guiding principles of OOP currently is the concept of “separation of concerns”. This means that you pull out small units of work into their own methods and classes. The idea of having one method that does a hundred things directly is the antithesis of this.
Splitting the functionality out makes your code easier to read, maintain and test.
There are a number of blog posts on the web about OOP best practices – SOLID being the driving one at the moment. If you look them up I’m sure any number of them can do a better job of describing them than I could.