note 51648 added to language.oop5.autoload
| From: | erikzoltanNOSPAMatcomcastdotnet at osu1 dot php dot net | Date: | Wed, 06 Apr 2005 14:41:01 +0000 |
| Subject: | note 51648 added to language.oop5.autoload | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-87584@lists.php.net to get a copy of this message | ||
When using __autoload you'll have one class in each file. I have developed the habit of
placing a UML class diagram at the top of each file. It's extremely helpful when you start to
work with a large number of classes, especially if you're part of a team. And it's easy
to do.
<?php
/*
|--------------------------------|
| MyExample : SomethingElse |
|--------------------------------|
| +$FirstProperty |
| +$SecondProperty: array |
| -$ThirdProperty |
|--------------------------------|
| +new MyExample() |
| #ClassMethod($a,$b,$c): number |
| +DoSomething() |
| -SomethingElse() |
|--------------------------------|
*/
class MyExample extends SomethingElse
{
public $FirstProperty;
public $SecondProperty = array();
private $ThirdProperty;
public __constructor()
{
}
public static function ClassMethod($a, $b, $c)
{
return $a+$b+$c;
}
public function DoSomething()
{
}
private function SomethingElse()
{
}
}
?>
Of course you have to maintain the UML comments along with your classes. (I'm planning to use
reflection to automate this process in the future so that issue will soon disappear.)
----
Manual Page -- http://www.php.net/manual/en/language.oop5.autoload.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+51648
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51648&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51648&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51648&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51648&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51648&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+51648&report=yes
Search -- http://master.php.net/manage/user-notes.php