SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Aug 2007
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Where am I being called from?

    Is there any way to check from where a property is being called?
    Like from outside an object, from inside its children or inside himself?

    I am doing some tests with the possibility of type hinting and strong typing classes like the structure proposed by jan.kneschke here, and doing so with the use of __get and __set.

    But I need to know where the property is being called from, since it seems that I can't simply access that information from inside the magic methods (since I am calling an unspecified property).

    I apreciate any help.

    Thanks
    Decio

  2. #2
    SitePoint Enthusiast
    Join Date
    Jul 2006
    Posts
    83
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My Network
    Deluxe Web Directory
    FontCubes Free Fonts

  3. #3
    SitePoint Member
    Join Date
    Aug 2007
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Where am I being called from?

    Quote Originally Posted by Grumps View Post

    Hi! Thanks for the reply, I have read that article and saw the concepts it exposes. I've read it while developping this application, and unfortunatelly couldn't find how it can help me.

    What I am trying to do is setting a way to declare strong typed fields within a class, and setting it as private, protected or public and as readonly, writeonly or both.

    For this to work, I am using the __get and __set magic methods to receive the call for an unset property (with the same "main" name as the ones declared inside the class, and check if it should be pointing to a "strong typed" declared property. So far so good and everything is working perfectly.

    The problem is that the __get and __set methods (expectedly) does not inform me if the call is being done from within the class, its children or from outside it, so I can't check for visibility.

    That is why I am looking for a possible way to make sure from where that property was called, so I can trigger the visibility check methods.

    Thanks!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •