Find the object that called this object?

Forgive me for the rough craziness here but if I have an object that calls another object into existence, is there a way for the second object to which object called it? For example, I’m building an authentication class that will be used by many classes and have permissions based on what class it’s being called by. So if the $agent class creates $agent->auth = new Auth, is there a way for $agent->auth to know that it’s being called by ‘agent’?

Any answers on this would be much appreciated ;)

Sponsor our Newsletter | Privacy Policy | Terms of Service