是否将一个php文件中的所有功能组合在一起?

So, I am working on a project and instead of making separate PHP files for different pieces of functionality in my project, I decided to go with the method of combining all the files with the use of modes, where there would be an index of modes to carry out different functionality. All the variables would be stored in one file and would only be used if a particular mode was called. Is this a bad habit? I am worried it might be inefficient and a security risk because the variables not being used could be exploited some how.

Considering all of Wordpress functions for a theme are in one file, I think it's a pretty standard practice.