|
12.5. FundamentalsIn this section, you learn some fundamentals and principles that you should apply to PEAR packages that you plan to release. 12.5.1. When and How to Include FilesYou can save yourself from some potential trouble by including files wisely. You should follow three principles on including files:
As an example, consider you're Package A, and Packages B and C provide classes with the same name. Your class, A, extends B, which in turn extends C. You do not maintain the B and C packages. See Figure 12.1. Figure 12.1. Nested dependencies.The only symbol directly referenced in A.php is B from B.php. It does not reference class C at all. In fact, you should assume that A.php is completely unaware that C.php even exists. By following this principle, you do not make assumptions about the internals of the B package that may change later. This makes your package more robust against changes in other packages. 12.5.2. Error HandlingPEAR code reports and catches errors through PEAR's error-handling API. This API is detailed in Chapter 7, "Error Handling." |
|