Hi, I have a class called User with static function loginRequired(), which returns false if the user is logged in and true if the user is logged out. It also appends an error to an error class that I created that tells the person using the site that they must be logged in to view the content.
The idea is that for the top of each function that would require the user to be logged in, we write this code:
if(User::loginRequired()) return;
Which will output the error and immediately return from the function. I would rather do this, however:
User::loginRequired();
And return from the calling function inside of the loginRequired function... but because loginRequired() is in a separate class in a separate file, this won't work. Is it possible to return from the function that calls loginRequired(), within loginRequired()?
Thanks.