INDEX
502
naming collisions, 71, 74
nested namespaces, declaring, 73
PHP 5.3 and, 14, 71
phpDocumentor and, 353
relative namespaces, 74
require_once(), 76
switching to global space within a file, 76
unqualified name, 73
use keyword, 74
using a domain name as a namespace, 73
using braces with the namespace keyword,
75
using the as clause with use, 75
NastyBoss class, 146–147
new operator, 16, 21
newInstance(), 96
newSelection(), 310
newUpdate(), 309–310
next(), 477
nextToken(), 472–473, 477
Nock, Clifton, 298, 311
notes element, 336
Notifier class, 140
notify(), 204–205
notifyAccess(), 282, 298
notifyError(), 333
notifyPasswordFailure(), 389
null, using in hinted arguments, 27
O
object lifelines, 117
object types, 25
object-oriented design
abstract classes, 45
Abstract Factory pattern, 157
abstract types as enabling polymorphism,
146
addEmployee(), 147
addParam(), 102
aesthetics of, 455
anonymous functions, 66, 68
assigning and passing objects by reference,
63
automated build, 459
call_user_func(), 67
callbacks, 66
centralizing common classes used in
multiple projects, 455
class switching, 106
code duplication, 109, 454
code smells, 109
coding to an interface, 141, 457
cohesion, definition of, 104
comparing to procedural programming,
100, 103
Conf class, code listing, 51
constant properties, 44
Continuous Integration (CI), 460
controller, 454
copying objects with __clone(), 63
coupling in, 104
create_function(), 67–68
declaring a class or method final, 57
decoupling, definition of, 454
defining string values for objects, 65
defining the boundaries of classes, 105
delegating object instantiation, 147
describing a class’s responsibility, 105
designing child classes to provide
specialized functionality, 132
destructor methods, 62
devising strategies for object generation,
145, 147
DomainObject class, 49
Employee class, 146, 148
encapsulating the concept that varies, 458
encapsulation, 107–108
Factory Method pattern, 152
factory, definition of, 44, 148
favoring composition over inheritance, 132
final keyword, 57
focusing on the metasystem, 458
Fowler, Martin, 110
getAllParams(), 102
getInstance(), 44, 102, 104, 149
global variables, 149, 454
instantiating objects as a dirty business, 147
interceptor methods, table of, 58
interfaces, 47
introducing dependencies in the name of
good design, 149
is_callable(), 67–68
Java and, 4

Get PHP Objects, Patterns, and Practice, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.