mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 08:58:56 +00:00
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:
parent
e50c8c25d5
commit
e438f7b8da
1 changed files with 5 additions and 4 deletions
|
@ -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') {
|
||||
|
|
Loading…
Reference in a new issue