<?PHP//BT Seed InterfaceInterfacebt{ Public functionprocess ();}//download processing class for BT seedsclassBtdownImplementsbt{ Public functionprocess () {//Output BT seeds Echo' Output BT seeds '; }}//BT seed upload processing classclassBtuploadImplementsbt{ Public functionprocess () {//Save the uploaded bt seeds Echo' Save the uploaded bt Seeds '; }}//interface of equipment for producing BT seed processing objectsInterfacebtcreator{ Public functioncreatebtobject ();}//equipment for the production of BT seed download processing objectsclassBtdowncreatorImplementsbtcreator{ Public functionCreatebtobject () {/** * If not an administrator, send 10 points*/ //then return to the BT seed download processing Object return NewBtdown (); }}//equipment for the production of BT seed upload processing objectsclassBtuploadcreatorImplementsbtcreator{ Public functionCreatebtobject () {/** * If not an administrator, send 10 points*/ //then return to the BT seed download processing Object return Newbtupload (); }}//factories that produce BT seed processing objectsclassbtfactory{//gets the object for the movie processing class, with the parameter class name Public functionGetbtobject ($name) { Switch($name) { Case' Btdown ':$creator=NewBtdowncreator (); Break; Case' Btupload ':$creator=NewBtuploadcreator (); Break; } return $creator-Createbtobject (); }}//Get BT Factory$btFactory=Newbtfactory ();//download and processing of BT seeds$what= ' Btdown ';$btObject=$btFactory->getbtobject ($what);$btObject-process ();//uploading and processing of BT seeds$what= ' Btupload ';$btObject=$btFactory->getbtobject ($what);$btObject-process ();?>
Factory method Mode