Created
September 13, 2011 23:58
-
-
Save fabioluciano/1215510 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Convert_Abstraction_AbstractFactory { | |
public function __construct() { | |
} | |
public static function convert($to) { | |
require_once('Convert_Abstraction_Factory.php'); | |
switch ($to) { | |
case 'png': | |
require_once 'Convert_Abstraction_Factory_PNG.php'; | |
$factory = new Abstract_Factory_Convert_PNG(); | |
break; | |
case 'jpg': | |
require_once 'Convert_Abstraction_Factory_JPG.php'; | |
$factory = new Abstract_Factory_Convert_JPG(); | |
break; | |
} | |
return $factory; | |
} | |
} | |
$abstractfactory = new Convert_Abstraction_AbstractFactory(); | |
$factory = $abstractfactory::convert('png'); | |
$factory->image_convert('jpg.jpg'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment