fix #33575: the example is a Parameterized Factory

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@200775 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Nuno Lopes 2005-11-18 11:14:24 +00:00
parent e50c8c25d5
commit e438f7b8da

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.7 $ -->
<!-- $Revision: 1.8 $ -->
<sect1 id="language.oop5.patterns">
<title>Patterns</title>
<para>
@ -12,16 +12,17 @@
<para>
The Factory pattern allows for the instantiation of objects
at runtime. It is called a Factory Pattern since it is
responsible for "manufacturing" an object.
responsible for "manufacturing" an object. A Parameterized Factory receives
the name of the class to instantiate as argument.
</para>
<example>
<title>Factory Method</title>
<title>Parameterized Factory Method</title>
<programlisting role="php">
<![CDATA[
<?php
class Example
{
// The factory method
// The parameterized factory method
public static function factory($type)
{
if (include_once 'Drivers/' . $type . '.php') {