public function getCode($arr)
 {
     $ModelPHPCode = "";
     $ControllerPHPCode = "";
     $zipfile = new ZipFile();
     foreach ($arr as $k => $v) {
         ## MODEL Class
         $ModelPHPCode = "";
         $ModelPHPCode .= "<" . "?php\r\n";
         $ModelPHPCode .= "/*\r\n\t@PHPClassCreator [Doctrine + CodeIgniter]\r\n\t@Autor: Esteban Fuentealba\r\n\t@Email:\tmi [dot] warezx [at] gmail [dot] com\r\n*/\r\n";
         $ModelPHPCode .= "// models/" . $v['class']['name'] . ".php\r\n";
         $ModelPHPCode .= "class " . $v['class']['name'] . " extends Doctrine_Record {\r\n";
         ## setTableDefinition
         $ModelPHPCode .= "\tpublic function setTableDefinition() {\r\n";
         foreach ($v['class']['method']['setTableDefinition'] as $index => $valor) {
             $ModelPHPCode .= "\t\t" . $valor . "\r\n";
         }
         $ModelPHPCode .= "\t}\r\n";
         ## setUp
         $ModelPHPCode .= "\tpublic function setUp() {\r\n";
         foreach ($v['class']['method']['setUp'] as $index => $valor) {
             foreach ($valor as $key => $val) {
                 $ModelPHPCode .= "\t\t" . $val . "\r\n";
             }
         }
         $ModelPHPCode .= "\t}\r\n";
         $ModelPHPCode .= "}\r\n";
         if ($this->debug) {
             echo $ModelPHPCode;
         } else {
             $zipfile->add_file($ModelPHPCode, "system/application/models/" . $v['class']['name'] . ".php");
         }
         ## FIN CLASS MODEL
         ## CONTROLLER MODEL
         $ControllerPHPCode = "";
         $ControllerPHPCode .= "<" . "?php\r\n";
         $ControllerPHPCode .= "/*\r\n\t@PHPClassCreator [Doctrine + CodeIgniter]\r\n\t@Autor: Esteban Fuentealba\r\n\t@Email:\tmi [dot] warezx [at] gmail [dot] com\r\n*/\r\n";
         $ControllerPHPCode .= "// system/application/controllers/" . $v['class']['name'] . "Controller.php\r\n";
         $ControllerPHPCode .= "require_once(dirname(__FILE__) .'/KoalaController.class.php');\r\n";
         $ControllerPHPCode .= "class " . $v['class']['name'] . "Controller extends KoalaController {\r\n";
         ## CONSTRUCTOR
         $ControllerPHPCode .= "\tpublic function __construct() {\r\n";
         $ControllerPHPCode .= "\t\tparent::Controller();\r\n";
         $ControllerPHPCode .= "\t\tparse_str(\$" . "_SERVER['QUERY_STRING'],\$" . "_GET);\r\n";
         $ControllerPHPCode .= "\t}\r\n";
         ## METHOD INSERT
         $ControllerPHPCode .= "\tpublic function Insert() {\r\n";
         $ControllerPHPCode .= "\t\t\$" . "clean = \$" . "this->input->xss_clean(\$" . "_GET);\r\n";
         $ControllerPHPCode .= "\t\t\$" . "c = new " . $v['class']['name'] . "();\r\n";
         $ControllerPHPCode .= "\t\ttry {\r\n";
         $ControllerPHPCode .= "\t\t\tforeach(\$" . "clean as \$" . "param => \$" . "value) {\r\n";
         $ControllerPHPCode .= "\t\t\t\t\$" . "c->\$" . "param = isset(\$" . "value) ? \$" . "value : null;\r\n";
         $ControllerPHPCode .= "\t\t\t}\r\n";
         $ControllerPHPCode .= "\t\t} catch(Doctrine_Record_UnknownPropertyException \$" . "e) {\r\n";
         $ControllerPHPCode .= "\t\t\t//xD\r\n";
         $ControllerPHPCode .= "\t\t}\r\n";
         $ControllerPHPCode .= "\t\ttry {\r\n";
         $ControllerPHPCode .= "\t\t\tforeach(\$" . "clean as \$" . "param => \$" . "value) {\r\n";
         $ControllerPHPCode .= "\t\t\t\t\$" . "c->\$" . "param = isset(\$" . "value) ? \$" . "value : null;\r\n";
         $ControllerPHPCode .= "\t\t\t}\r\n";
         $ControllerPHPCode .= "\t\t} catch(Doctrine_Record_UnknownPropertyException \$" . "e) {\r\n";
         $ControllerPHPCode .= "\t\t\t//xD\r\n";
         $ControllerPHPCode .= "\t\t}\r\n";
         $ControllerPHPCode .= "\t}\r\n";
         $ControllerPHPCode .= "}\r\n";
         ## FIN CONTROLLER MODEL
         if ($this->debug) {
             echo $ControllerPHPCode;
         } else {
             $zipfile->add_file($ControllerPHPCode, "system/application/models/" . $v['class']['name'] . "Controller.php");
         }
     }
     if (!$this->debug) {
         header("Content-type: application/octet-stream");
         header("Content-disposition: attachment; filename=PHPClassCreator-" . time() . ".zip");
         echo $zipfile->file();
     }
 }