Using require() and include() inside a class

wordpress
themeforest

#1

Hello everyone,

I’ve been developing a theme and trying my best to keep up to the PHP, WordPress and ThemeForest standards. So far, I have a separate class for my theme’s framework. In this class, I have used include() and require() methods within the constructor. Say my structure looks like follows.

class MyTheme_Framework {
    public function __construct() {
        require('another-file.php')
    }
}

I wonder if it is a good practise to do so. Is there any possibility of rejection? I have searched online and couldn’t find any proper answers.

The other way I can think is by defining a static class in ‘another-file.php’ so that I can move the require statement outside the class declaration.