Re: File naming conventions
| From: | Chuck Hagenbuch | Date: | Thu, 01 Mar 2001 15:59:19 +0000 |
| Subject: | Re: File naming conventions | ||
| Groups: | php.pear | ||
| Request: | Send a blank email to php-pear+get-1520@lists.php.net to get a copy of this message | ||
Quoting Ulf Wendel <ulf.wendel@phpdoc.de>:
> what are the current file naming conventions? I strongly recommend
> naming a file like the class it contains.
Okay, here goes:
- filenames always end in .php
- class names are best illustrated through examples.
If the class is named Cache, then it should live in a file called Cache.php at
the top level of the pear hierarchy.
If the class is a subclass of Cache - say, Cache_Output - then it should live
inside a Cache/ directory, and be named Output.php.
If the class is a subclass that should be instantiated by a factory method, and
never directly, then the same rules apply, but the name of the class itself -
not the whole hierarchy - should be lowercase. So, a file-based implementation
of Cache_Container becomes the Cache_Container_file class, and it lives in the
Cache/Container/file.php file.
Basically, underscores ('_') translate to directories/class hierarchy, and
everything is studlycaps except:
- underscores to indicate hierarchy
- factory subclasses, which have the last part of their name lowercased.
How's that? Someone want to clean up anything that's unclear and toss it into
CODING_STANDARDS? =)
-chuck
--
Charles Hagenbuch, <chuck@horde.org>
"We have no fuel on board, plus or minus 8 kilograms." -A NASA scientist