OOP question in relation to PEAR::Auth
| From: | Jeroen Houben | Date: | Tue, 25 Feb 2003 09:43:47 +0000 |
| Subject: | OOP question in relation to PEAR::Auth | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-3942@lists.php.net to get a copy of this message | ||
Hello
Imagine the following situation:
I have a page class which has some properties and methods like:
$owner
$lastModified
...
Now I want to make a visitor class which I think should be a property of the page class, because a page "has a" visitor (and not "is a" visitor)
This would make my page class. So the page class would be something like:
class Page
{
$_owner;
$_lastModified;
$visitor;
}
I _think_ this is all okay, but I'm not sure what to do with the visitor class.. It will have properties (or variables, what do I call them?) like:
$remoteIP;
$browser;
etc..
and, depending if the user is logged in, and email address, a username, lastname etc.
I don't know whether I should extend PEAR::Auth to do this:
class Visitor extends Auth
{
$remoreIP;
.. etc
}
or create a seperate class for visitor and make an instance of the Auth class a property of this class:
class Visitor
{
$remoteIP;
$auth; // PEAR::Auth instance;
}
I can't figure out if my visitor class "is an" Auth or "has an" Auth.
Any hints?
Jeroen