PHP Objects, Patterns and Practice (3rd edition)

(Barry) #1
■ INDEX

channel element, 335, 339


channel-discover command, 328
channel-info command, 328
char_no(), 473
CharacterParse class, code listing, 477
Chargeable interface, 47
checkout command, 374
checkout target, 448
child class, 27
Civilization-style game
accept(), 211–212
addUnit(), 171, 173, 176, 213
Archer class, 170
Army class, 171
ArmyVisitor class, 213–214
AuthenticateRequest class, 180
bombardStrength(), 170–171, 176
code listing, 170
CompositeUnit class, 211
DecorateProcess class, 183
defensiveStrength(), 171
Diamond class, 182
Forest class, 180
getComposite(), 176–177
getDepth(), 211
getReport(), 215
getTax(), 215
getWealthFactor(), 179, 182
handling terrains with the Abstract Factory
method, 163
joinExisting(), 177
LaserCannonUnit class, 170
LogRequest class, 180
MainProcess class, 183
movementRange(), 171
Pollution class, 182
process(), 184
ProcessRequest class, 180, 183
Prototype pattern, code listing, 163
removeUnit(), 173, 176
setDepth(), 211
splitting composite classes off into a
CompositeUnit class, 175
storage in relational databases, 178
storage in XML, 178
StructureRequest class, 180
summary of, 178


TaxCollectionVisitor class, 215
Tile class, 179
$tile property, 182
TileDecorator class, 182
Unit class, 170, 210
$units property, 171, 173
visit(), 212
visitArmy(), 213
class diagrams, 110
classData(), 90
classes
abstract classes, 45–46
abstract super class, creating, 142
accessing a class residing in a global (non-
namespaced) space, 75
accessing methods and properties in the
context of a class, 41
accessing property variables, 18
accessor methods, 37
array hinting, 27
assigning values to properties, 18
__autoload(), 80
__call(), 86
call_user_func(), 86
call_user_func_array(), 86–87
class keyword, 15
class names, 15
class switching, 106
class type hints, 26
class_exists(), code example, 82
classes and objects, understanding, 15
client code, definition of, 18
__construct(), 21
constructor method, 21
constructors and inheritance, 33
declaring, 15
declaring a class or method final, 57
declaring class elements as public, private,
or protected, 35
defining the boundaries of classes, 105
definition of, 15
deriving classes from a base class, 27
describing a class’s responsibility, 105
designing child classes to provide
specialized functionality, 132
documenting with phpDocumentor, 352
extends keyword, 32
Free download pdf