Tài liệu PHP Objects, Patterns and Practice- P12 - Pdf 87

■ 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

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

responsibility and the controlling code, 103
reusability, promoting, 455
sale(), 67
simplexml_load_file(), 52
Singleton pattern, 149
SpreadSheet class, 50
static elements, characteristics of, 43
static factory method, 49
static methods, definition of, 42
test frameworks, benefits of, 459
$this pseudo-variable, 42
tight coupling, causes of, 454
__toString(), 65
well-designed objects as self-enclosed, 454
write(), 102
See also design patterns
object-relational impedance mismatch, 276
objects
casting an object to a string, 16
classes and objects, understanding, 15
definition of, 16
identifiers, 16
initial rise of, in PHP, 11
new operator, 16, 21
pass-by-reference rather than pass-by-value,
12–13
PEAR and object-oriented programming, 13
PHP 3 and, 11
PHP 4 and, 12
PHP 5 and, 13

onConsecutiveCalls(), 391
operations, 112
OperatorExpression class, 194
operators
instanceof, 31, 83, 108
new, 16, 21
optional element, 340
orthogonality
definition of, 104
■ INDEX
504
orthogonal code, advantages of, 104
output attribute, 448
outputAddresses(), 23
overloading, 58
override attribute, 414
Overview screen, 443
overwrite attribute, 422
■ P
package command, 341
package element, 339
@package tag, 351, 353
package.xml, 327, 435
adding the lib directory to the include path,
337
api element, 336
channel element, 335
contents element, 336
dependency elements, table of, 339
description element, 335

76
Page Controller pattern, 222
AddVenueController class, code listing, 259
advantages and disadvantages of, 261
controller element, 258
error.php, 258
exit(), 258
forward(), 259
include(), 258
overview of, 257
process(), 259
venues.php, 261
view element, 258
PageController class, code listing, 258
parallel conditionals, 141, 149, 454
@param tag, 355
parameters, 112
ParamHandler class, 104, 108
parent class, 27
parent keyword, 33, 35, 42
Parser class, code listing, 474
pattern languages, 125
patternset element
description of, 418
table of attributes, 419
PDO class, 404
code listing, 43
getInstance(), 44
PEAR, 6, 459
acquire(), 333

file roles, table of, 336
finding API documentation, 330
generating archived and compressed
packages for shipment, 341
getBacktrace(), table of elements, 331
getCause(), 332–333
getCode(), 331
getErrorClass(), 332
getErrorData(), 332
getErrorMethod(), 332
getMessage(), 331
handling initial configuration options, 325
handling project installations with, 407
hosting a channel with a third-party
provider, 342
install element, 341
installconditions element, 341
installing packages with the install
command, 326
isError(), 331
Linux systems, 324
Log package, installing, 326
managing packages, 344
max element, 339
MDB2 package, 138
MDB2_Driver_Common class, 138
migrating to, 325
min element, 339
MyConfig class, code example, 330
notifyError(), 333

sample list of available packages, 318
setting an error_reporting directive, 330
Unix systems, 324
uri element, 339
using PEAR packages, 329
using Pyrus channel management to serve
PEAR packages, 342
using the naming convention common to
PEAR packages, 78
wget command, 327
XML_Feed_Parser package, 332
See also PHP
pear package command, 448
PEAR_Exception class, 332
pearinstaller element, 339
performOperations(), 293
Perl, 11
persistence classes, illustration of, 312
PersistenceFactory class, illustration of, 301
Phing, 7, 439, 459
■ INDEX
506
acquiring and installing, 408
adding a dependency to a build file, 410
Ant, 407
begintoken attribute, 420
build.xml, 407, 409
building up include and exclude rules, 417
clean argument, 425
commenting build files, 409

overwrite attribute, 422
patternset element, table of attributes, 419
PEAR and, 408
phing command, 408
project element, 409
-projecthelp flag, 411
promptChar attribute, 424
properties, built-in, 415
properties, declaring, 412
properties, setting on the command line,
414
propertyName attribute, 424
replacetokens element, 420
ReplaceTokens filter, 420
setpass target, 424
srclib fileset element, 422
StripPhpComments task, 419
target element, table of attributes, 414
targets, setting up dependencies, 410
tasks, definition of, 421
unless attribute, 412–413
uses for, 408
using make as a build solution, 407
-v flag, 408
ways of setting a property, 416
when a property isn’t found, 415
XML declaration, including, 409
PHP
Atkinson, Leon, 5
Fuecks, Harry, 5

installing and using, 433
phpcb command line tool, 434
PHP_CodeSniffer, 433
php.ini, 79, 337
phpdoc command, 349
PHPDocumentor, 7, 321, 431, 459
adding comments to source code, 350
@author tag, 352
Beaver, Greg, 353
class relationships, viewing, 350
classes, documenting, 352
@copyright tag, 352
creating hyperlinks in documentation, 356
-d flag, 349
-dn flag, 349
DocBlock comments, 350, 352
documentation, generating, 349
documenting methods, 355
documenting private elements, 354
documenting properties, 353
downloading and installing, 348
file-level documentation, providing, 353
-h flag, 348
@license tag, 353
@link tag, 358
making a reciprocal link, 358
namespaces and, 353
navigating and examing packages, 351
output menu, sample page, 349
@package tag, 351, 353

AssertThat(), 387
AssertTrue(), 386
behavior verification, 389
Bergmann, Sebastian, 382
brittle nature of many test harnesses, 404
centralizing test fixtures into Object
Mothers, 405
checking the behavior of the UserStore class
when an operation fails, 385
combining real and mocked components in
testing, 405
constraints, 386
creating a minimal test case class, 382
creating a test method, 383
creating a Web UI superclass, 398
DBFace class, 404
debugging tests, 404
expects(), 389–390
exporting a Selenium test as a PHPUnit
class, 402
fail(), 385
faking the context of the class you are
testing, 389
fixture, definition of, 383
fluent interface, 389–390
getMock(), 389
getUser(), 393
handleRequest(), 395
installing using PEAR, 382
is_array(), 393


Nhờ tải bản gốc
Music ♫

Copyright: Tài liệu đại học © DMCA.com Protection Status