__construct question

Hello,

I am wondering what is acceptable and isn’t acceptable to be places inside the function __construct.

Lets say I am building a class that accepts only one or two types of file extensions for manipulation, whether it be reading and then printing the file as an array or saving the information from the file to a database.

Would it be acceptable to check the file type in the constructor is every function needs to check to ensure the file type is the proper extension or should this be built into a function of it’s self and then called every time it’s needed.

Thanks,
Valandor

Sponsor our Newsletter | Privacy Policy | Terms of Service