@@ -20,13 +20,13 @@ |
||
| 20 | 20 | ; database host |
| 21 | 21 | host = <?= $host ?><?= "\n" ?> |
| 22 | 22 | ; database name |
| 23 | -database = "<?= isset( $database ) ? $database : '' ?>"<?= "\n" ?> |
|
| 23 | +database = "<?= isset($database) ? $database : '' ?>"<?= "\n" ?> |
|
| 24 | 24 | ; database schema name (one or more than one) |
| 25 | -<?= isset( $schema ) ? 'schema = ' . $schema : ';schema = public' ?><?= "\n" ?> |
|
| 25 | +<?= isset($schema) ? 'schema = ' . $schema : ';schema = public' ?><?= "\n" ?> |
|
| 26 | 26 | ; database user |
| 27 | -username = <?= isset( $username ) ? $username : '' ?><?= "\n" ?> |
|
| 27 | +username = <?= isset($username) ? $username : '' ?><?= "\n" ?> |
|
| 28 | 28 | ; database password |
| 29 | -password = <?= isset( $password ) ? $password : '' ?><?= "\n" ?> |
|
| 29 | +password = <?= isset($password) ? $password : '' ?><?= "\n" ?> |
|
| 30 | 30 | ; show status of implementation carried out after completing the process |
| 31 | 31 | status = false |
| 32 | 32 | ; specify where to create the files (default is current directory) |
@@ -10,13 +10,13 @@ discard block |
||
| 10 | 10 | * |
| 11 | 11 | * @param $dir |
| 12 | 12 | */ |
| 13 | - public static function makeDir ( $dir ) |
|
| 13 | + public static function makeDir($dir) |
|
| 14 | 14 | { |
| 15 | - if ( !is_dir ( $dir ) ) |
|
| 15 | + if ( ! is_dir($dir)) |
|
| 16 | 16 | { |
| 17 | - if ( !@mkdir ( $dir, 0755, true ) ) |
|
| 17 | + if ( ! @mkdir($dir, 0755, true)) |
|
| 18 | 18 | { |
| 19 | - die( "error: could not create directory $dir\n" ); |
|
| 19 | + die("error: could not create directory $dir\n"); |
|
| 20 | 20 | } |
| 21 | 21 | } |
| 22 | 22 | } |
@@ -26,16 +26,16 @@ discard block |
||
| 26 | 26 | * @param string $tplContent Conteudo do Template |
| 27 | 27 | * @param bool $overwrite Sobrescreve o arquivo ja existente |
| 28 | 28 | */ |
| 29 | - public static function makeSourcer ( $nameFile, $tplContent, $overwrite = false ) |
|
| 29 | + public static function makeSourcer($nameFile, $tplContent, $overwrite = false) |
|
| 30 | 30 | { |
| 31 | - if ( !$overwrite && is_file ( $nameFile ) ) |
|
| 31 | + if ( ! $overwrite && is_file($nameFile)) |
|
| 32 | 32 | { |
| 33 | 33 | return; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - if ( !file_put_contents ( $nameFile, $tplContent ) ) |
|
| 36 | + if ( ! file_put_contents($nameFile, $tplContent)) |
|
| 37 | 37 | { |
| 38 | - die( "Error: could not write model file $nameFile." ); |
|
| 38 | + die("Error: could not write model file $nameFile."); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | |
@@ -46,24 +46,24 @@ discard block |
||
| 46 | 46 | * |
| 47 | 47 | * @return string |
| 48 | 48 | */ |
| 49 | - public static function getClassName ( $str ) |
|
| 49 | + public static function getClassName($str) |
|
| 50 | 50 | { |
| 51 | 51 | $temp = ''; |
| 52 | - foreach ( explode ( self::SEPARETOR, $str ) as $part ) |
|
| 52 | + foreach (explode(self::SEPARETOR, $str) as $part) |
|
| 53 | 53 | { |
| 54 | - $temp .= ucfirst ( $part ); |
|
| 54 | + $temp .= ucfirst($part); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | return $temp; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - protected function getParsedTplContents ( $filePath, $vars = array () ) |
|
| 60 | + protected function getParsedTplContents($filePath, $vars = array()) |
|
| 61 | 61 | { |
| 62 | - extract ( $vars ); |
|
| 63 | - ob_start (); |
|
| 62 | + extract($vars); |
|
| 63 | + ob_start(); |
|
| 64 | 64 | require $filePath; |
| 65 | - $data = ob_get_contents (); |
|
| 66 | - ob_end_clean (); |
|
| 65 | + $data = ob_get_contents(); |
|
| 66 | + ob_end_clean(); |
|
| 67 | 67 | |
| 68 | 68 | return $data; |
| 69 | 69 | } |
@@ -1,32 +1,32 @@ |
||
| 1 | 1 | <?php |
| 2 | -define ( 'PREFIX', 'orm-generator' ); |
|
| 3 | -define ( 'PHAR_FILE', PREFIX . '.phar' ); |
|
| 4 | -define ( 'PHAR_OUTPUT', 'bin' . DIRECTORY_SEPARATOR . PHAR_FILE ); |
|
| 5 | -define ( 'DEFAULT_STUB', 'phar-generate.php' ); |
|
| 6 | -define ( 'BUILD_DIR', realpath ( __DIR__ . '/build' ) ); |
|
| 7 | -define ( 'INCLUDE_EXTENSION', '/\.php$/' ); |
|
| 2 | +define('PREFIX', 'orm-generator'); |
|
| 3 | +define('PHAR_FILE', PREFIX . '.phar'); |
|
| 4 | +define('PHAR_OUTPUT', 'bin' . DIRECTORY_SEPARATOR . PHAR_FILE); |
|
| 5 | +define('DEFAULT_STUB', 'phar-generate.php'); |
|
| 6 | +define('BUILD_DIR', realpath(__DIR__ . '/build')); |
|
| 7 | +define('INCLUDE_EXTENSION', '/\.php$/'); |
|
| 8 | 8 | |
| 9 | 9 | try |
| 10 | 10 | { |
| 11 | - if ( file_exists ( PHAR_OUTPUT ) ) |
|
| 11 | + if (file_exists(PHAR_OUTPUT)) |
|
| 12 | 12 | { |
| 13 | - unlink ( PHAR_OUTPUT ); |
|
| 13 | + unlink(PHAR_OUTPUT); |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | /**************************************** |
| 17 | 17 | * phar file creation |
| 18 | 18 | ****************************************/ |
| 19 | - $tarphar = new Phar( PHAR_OUTPUT ); |
|
| 20 | - $phar = $tarphar->convertToExecutable ( Phar::PHAR ); |
|
| 21 | - $phar->startBuffering (); |
|
| 22 | - $phar->buildFromDirectory ( BUILD_DIR, INCLUDE_EXTENSION ); |
|
| 23 | - $stub = $phar->createDefaultStub ( DEFAULT_STUB ); |
|
| 24 | - $phar->setStub ( "#!/usr/bin/php\n" . $stub ); |
|
| 25 | - $phar->stopBuffering (); |
|
| 19 | + $tarphar = new Phar(PHAR_OUTPUT); |
|
| 20 | + $phar = $tarphar->convertToExecutable(Phar::PHAR); |
|
| 21 | + $phar->startBuffering(); |
|
| 22 | + $phar->buildFromDirectory(BUILD_DIR, INCLUDE_EXTENSION); |
|
| 23 | + $stub = $phar->createDefaultStub(DEFAULT_STUB); |
|
| 24 | + $phar->setStub("#!/usr/bin/php\n" . $stub); |
|
| 25 | + $phar->stopBuffering(); |
|
| 26 | 26 | |
| 27 | 27 | |
| 28 | 28 | } |
| 29 | -catch ( Exception $e ) |
|
| 29 | +catch (Exception $e) |
|
| 30 | 30 | { |
| 31 | 31 | echo $e; |
| 32 | 32 | } |
| 33 | 33 | \ No newline at end of file |
@@ -25,8 +25,7 @@ |
||
| 25 | 25 | $phar->stopBuffering (); |
| 26 | 26 | |
| 27 | 27 | |
| 28 | -} |
|
| 29 | -catch ( Exception $e ) |
|
| 28 | +} catch ( Exception $e ) |
|
| 30 | 29 | { |
| 31 | 30 | echo $e; |
| 32 | 31 | } |
| 33 | 32 | \ No newline at end of file |
@@ -6,26 +6,26 @@ discard block |
||
| 6 | 6 | * @author Pedro Alarcao <[email protected]> |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -if ( ! ini_get ( 'short_open_tag' ) ) |
|
| 9 | +if ( ! ini_get('short_open_tag')) |
|
| 10 | 10 | { |
| 11 | - die( "please enable short_open_tag directive in php.ini\n" ); |
|
| 11 | + die("please enable short_open_tag directive in php.ini\n"); |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | -if ( ! ini_get ( 'register_argc_argv' ) ) |
|
| 14 | +if ( ! ini_get('register_argc_argv')) |
|
| 15 | 15 | { |
| 16 | - die( "please enable register_argc_argv directive in php.ini\n" ); |
|
| 16 | + die("please enable register_argc_argv directive in php.ini\n"); |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | |
| 20 | -if ( function_exists ( 'ini_set' ) ) |
|
| 20 | +if (function_exists('ini_set')) |
|
| 21 | 21 | { |
| 22 | - @ini_set ( 'display_errors' , 1 ); |
|
| 22 | + @ini_set('display_errors', 1); |
|
| 23 | 23 | |
| 24 | - $memoryInBytes = function ( $value ) |
|
| 24 | + $memoryInBytes = function($value) |
|
| 25 | 25 | { |
| 26 | - $unit = strtolower ( substr ( $value , - 1 , 1 ) ); |
|
| 26 | + $unit = strtolower(substr($value, - 1, 1)); |
|
| 27 | 27 | $value = (int) $value; |
| 28 | - switch ( $unit ) |
|
| 28 | + switch ($unit) |
|
| 29 | 29 | { |
| 30 | 30 | case 'g': |
| 31 | 31 | $value *= 1024; |
@@ -40,21 +40,21 @@ discard block |
||
| 40 | 40 | return $value; |
| 41 | 41 | }; |
| 42 | 42 | |
| 43 | - $memoryLimit = trim ( ini_get ( 'memory_limit' ) ); |
|
| 43 | + $memoryLimit = trim(ini_get('memory_limit')); |
|
| 44 | 44 | // Increase memory_limit if it is lower than 1GB |
| 45 | - if ( $memoryLimit != - 1 && $memoryInBytes( $memoryLimit ) < 1024 * 1024 * 1024 ) |
|
| 45 | + if ($memoryLimit != - 1 && $memoryInBytes($memoryLimit) < 1024 * 1024 * 1024) |
|
| 46 | 46 | { |
| 47 | - @ini_set ( 'memory_limit' , '1G' ); |
|
| 47 | + @ini_set('memory_limit', '1G'); |
|
| 48 | 48 | } |
| 49 | - unset( $memoryInBytes , $memoryLimit ); |
|
| 49 | + unset($memoryInBytes, $memoryLimit); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | -set_include_path ( |
|
| 53 | - implode ( |
|
| 54 | - PATH_SEPARATOR , |
|
| 55 | - array ( |
|
| 56 | - realpath ( dirname ( __FILE__ ) . "/build/" ) , |
|
| 57 | - get_include_path () , |
|
| 52 | +set_include_path( |
|
| 53 | + implode( |
|
| 54 | + PATH_SEPARATOR, |
|
| 55 | + array( |
|
| 56 | + realpath(dirname(__FILE__) . "/build/"), |
|
| 57 | + get_include_path(), |
|
| 58 | 58 | ) |
| 59 | 59 | ) |
| 60 | 60 | ); |
@@ -65,34 +65,34 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | try |
| 67 | 67 | { |
| 68 | - $arrValid = array ( |
|
| 69 | - 'version' , |
|
| 70 | - 'help' , |
|
| 71 | - 'status' , |
|
| 72 | - 'init' , |
|
| 73 | - 'config-env:' , |
|
| 74 | - 'config-ini:' , |
|
| 75 | - 'database:' , |
|
| 76 | - 'schema:' , |
|
| 77 | - 'driver:' , |
|
| 78 | - 'framework:' , |
|
| 68 | + $arrValid = array( |
|
| 69 | + 'version', |
|
| 70 | + 'help', |
|
| 71 | + 'status', |
|
| 72 | + 'init', |
|
| 73 | + 'config-env:', |
|
| 74 | + 'config-ini:', |
|
| 75 | + 'database:', |
|
| 76 | + 'schema:', |
|
| 77 | + 'driver:', |
|
| 78 | + 'framework:', |
|
| 79 | 79 | 'path:' |
| 80 | 80 | ); |
| 81 | 81 | |
| 82 | - $_path = realpath ( __FILE__ ); |
|
| 83 | - $argv = getopt ( null , $arrValid ); |
|
| 82 | + $_path = realpath(__FILE__); |
|
| 83 | + $argv = getopt(null, $arrValid); |
|
| 84 | 84 | |
| 85 | - if ( array_key_exists ( 'init' , $argv ) ) |
|
| 85 | + if (array_key_exists('init', $argv)) |
|
| 86 | 86 | { |
| 87 | - $maker = new \Classes\MakerConfigFile( $argv , $_path ); |
|
| 87 | + $maker = new \Classes\MakerConfigFile($argv, $_path); |
|
| 88 | 88 | } else |
| 89 | 89 | { |
| 90 | - $maker = new \Classes\MakerFile( new \Classes\Config( $argv , $_path ) ); |
|
| 90 | + $maker = new \Classes\MakerFile(new \Classes\Config($argv, $_path)); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - $maker->run (); |
|
| 93 | + $maker->run(); |
|
| 94 | 94 | |
| 95 | -} catch ( \Exception $e ) |
|
| 95 | +} catch (\Exception $e) |
|
| 96 | 96 | { |
| 97 | - die( $e->getMessage () ); |
|
| 97 | + die($e->getMessage()); |
|
| 98 | 98 | } |
@@ -3,15 +3,15 @@ |
||
| 3 | 3 | /** |
| 4 | 4 | * Application Entity |
| 5 | 5 | * |
| 6 | - * <?=$this->config->last_modify."\n"?> |
|
| 6 | + * <?=$this->config->last_modify . "\n"?> |
|
| 7 | 7 | * |
| 8 | 8 | * @package <?=$this->config->namespace?>Model |
| 9 | 9 | * @subpackage Model |
| 10 | - * @author <?=$this->config->author."\n"?> |
|
| 10 | + * @author <?=$this->config->author . "\n"?> |
|
| 11 | 11 | * |
| 12 | - * @copyright <?=$this->config->copyright."\n"?> |
|
| 13 | - * @license <?=$this->config->license."\n"?> |
|
| 14 | - * @link <?=$this->config->link."\n"?> |
|
| 12 | + * @copyright <?=$this->config->copyright . "\n"?> |
|
| 13 | + * @license <?=$this->config->license . "\n"?> |
|
| 14 | + * @link <?=$this->config->link . "\n"?> |
|
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | 17 | abstract class <?=$this->config->namespace?>Model_EntityAbstract extends Zend_Db_Table_Row_Abstract |
@@ -178,14 +178,14 @@ |
||
| 178 | 178 | public function createDependece ( $constraint_name , $table_name , $column_name , $schema = null ) |
| 179 | 179 | { |
| 180 | 180 | $objConstrantDependence = Constrant::getInstance () |
| 181 | - ->populate ( |
|
| 182 | - array ( |
|
| 183 | - 'constrant' => $constraint_name , |
|
| 184 | - 'schema' => $schema , |
|
| 185 | - 'table' => $table_name , |
|
| 186 | - 'column' => $column_name |
|
| 187 | - ) |
|
| 188 | - ); |
|
| 181 | + ->populate ( |
|
| 182 | + array ( |
|
| 183 | + 'constrant' => $constraint_name , |
|
| 184 | + 'schema' => $schema , |
|
| 185 | + 'table' => $table_name , |
|
| 186 | + 'column' => $column_name |
|
| 187 | + ) |
|
| 188 | + ); |
|
| 189 | 189 | |
| 190 | 190 | $this->addDependece ( $objConstrantDependence ); |
| 191 | 191 | |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * |
| 17 | 17 | * @author Pedro Alarcao <[email protected]> |
| 18 | 18 | */ |
| 19 | - final private function __construct () |
|
| 19 | + final private function __construct() |
|
| 20 | 20 | { |
| 21 | 21 | } |
| 22 | 22 | |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * |
| 26 | 26 | * @return \Classes\Db\Column |
| 27 | 27 | */ |
| 28 | - public static function getInstance () |
|
| 28 | + public static function getInstance() |
|
| 29 | 29 | { |
| 30 | 30 | return new Column(); |
| 31 | 31 | } |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | /** |
| 79 | 79 | * @return string |
| 80 | 80 | */ |
| 81 | - public function getName () |
|
| 81 | + public function getName() |
|
| 82 | 82 | { |
| 83 | 83 | return $this->name; |
| 84 | 84 | } |
@@ -88,12 +88,12 @@ discard block |
||
| 88 | 88 | * |
| 89 | 89 | * @param $array |
| 90 | 90 | */ |
| 91 | - public function populate ( $array ) |
|
| 91 | + public function populate($array) |
|
| 92 | 92 | { |
| 93 | - $this->name = $array[ 'name' ]; |
|
| 94 | - $this->type = $array[ 'type' ]; |
|
| 95 | - $this->nullable = $array[ 'nullable' ]; |
|
| 96 | - $this->max_length = $array[ 'max_length' ]; |
|
| 93 | + $this->name = $array['name']; |
|
| 94 | + $this->type = $array['type']; |
|
| 95 | + $this->nullable = $array['nullable']; |
|
| 96 | + $this->max_length = $array['max_length']; |
|
| 97 | 97 | |
| 98 | 98 | return $this; |
| 99 | 99 | } |
@@ -101,31 +101,31 @@ discard block |
||
| 101 | 101 | /** |
| 102 | 102 | * @return boolean |
| 103 | 103 | */ |
| 104 | - public function isPrimaryKey () |
|
| 104 | + public function isPrimaryKey() |
|
| 105 | 105 | { |
| 106 | - return ! empty( $this->primarykey ); |
|
| 106 | + return ! empty($this->primarykey); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /** |
| 110 | 110 | * @return boolean |
| 111 | 111 | */ |
| 112 | - public function isForeingkey () |
|
| 112 | + public function isForeingkey() |
|
| 113 | 113 | { |
| 114 | - return ! empty( $this->refForeingkey ); |
|
| 114 | + return ! empty($this->refForeingkey); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | /** |
| 118 | 118 | * @return boolean |
| 119 | 119 | */ |
| 120 | - public function hasDependence () |
|
| 120 | + public function hasDependence() |
|
| 121 | 121 | { |
| 122 | - return ! empty( $this->dependences ); |
|
| 122 | + return ! empty($this->dependences); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /** |
| 126 | 126 | * @return string |
| 127 | 127 | */ |
| 128 | - public function getType () |
|
| 128 | + public function getType() |
|
| 129 | 129 | { |
| 130 | 130 | return $this->type; |
| 131 | 131 | } |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | /** |
| 134 | 134 | * @return string |
| 135 | 135 | */ |
| 136 | - public function getComment () |
|
| 136 | + public function getComment() |
|
| 137 | 137 | { |
| 138 | 138 | return $this->comment; |
| 139 | 139 | } |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | /** |
| 142 | 142 | * @param string $comment |
| 143 | 143 | */ |
| 144 | - public function setComment ( $comment ) |
|
| 144 | + public function setComment($comment) |
|
| 145 | 145 | { |
| 146 | 146 | $this->comment = $comment; |
| 147 | 147 | |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | /** |
| 152 | 152 | * @param \Classes\Db\Constrant $primarykey |
| 153 | 153 | */ |
| 154 | - public function setPrimaryKey ( Constrant $primarykey ) |
|
| 154 | + public function setPrimaryKey(Constrant $primarykey) |
|
| 155 | 155 | { |
| 156 | 156 | $this->primarykey = $primarykey; |
| 157 | 157 | |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | /** |
| 162 | 162 | * @param \Classes\Db\Constrant $dependece |
| 163 | 163 | */ |
| 164 | - public function addDependece ( Constrant $dependece ) |
|
| 164 | + public function addDependece(Constrant $dependece) |
|
| 165 | 165 | { |
| 166 | 166 | $this->dependences[] = $dependece; |
| 167 | 167 | |
@@ -175,19 +175,19 @@ discard block |
||
| 175 | 175 | * |
| 176 | 176 | * @return $this |
| 177 | 177 | */ |
| 178 | - public function createDependece ( $constraint_name , $table_name , $column_name , $schema = null ) |
|
| 178 | + public function createDependece($constraint_name, $table_name, $column_name, $schema = null) |
|
| 179 | 179 | { |
| 180 | - $objConstrantDependence = Constrant::getInstance () |
|
| 181 | - ->populate ( |
|
| 182 | - array ( |
|
| 183 | - 'constrant' => $constraint_name , |
|
| 184 | - 'schema' => $schema , |
|
| 185 | - 'table' => $table_name , |
|
| 180 | + $objConstrantDependence = Constrant::getInstance() |
|
| 181 | + ->populate( |
|
| 182 | + array( |
|
| 183 | + 'constrant' => $constraint_name, |
|
| 184 | + 'schema' => $schema, |
|
| 185 | + 'table' => $table_name, |
|
| 186 | 186 | 'column' => $column_name |
| 187 | 187 | ) |
| 188 | 188 | ); |
| 189 | 189 | |
| 190 | - $this->addDependece ( $objConstrantDependence ); |
|
| 190 | + $this->addDependece($objConstrantDependence); |
|
| 191 | 191 | |
| 192 | 192 | return $this; |
| 193 | 193 | } |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | /** |
| 196 | 196 | * @param \Classes\Db\Constrant $reference |
| 197 | 197 | */ |
| 198 | - public function addRefFk ( Constrant $reference ) |
|
| 198 | + public function addRefFk(Constrant $reference) |
|
| 199 | 199 | { |
| 200 | 200 | $this->refForeingkey = $reference; |
| 201 | 201 | |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | * |
| 208 | 208 | * @return \Classes\Db\Constrant |
| 209 | 209 | */ |
| 210 | - public function getFks () |
|
| 210 | + public function getFks() |
|
| 211 | 211 | { |
| 212 | 212 | return $this->refForeingkey; |
| 213 | 213 | } |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | * |
| 218 | 218 | * @return \Classes\Db\Constrant[] |
| 219 | 219 | */ |
| 220 | - public function getDependences () |
|
| 220 | + public function getDependences() |
|
| 221 | 221 | { |
| 222 | 222 | return $this->dependences; |
| 223 | 223 | } |
@@ -225,9 +225,9 @@ discard block |
||
| 225 | 225 | /** |
| 226 | 226 | * @return bool |
| 227 | 227 | */ |
| 228 | - public function hasDependences () |
|
| 228 | + public function hasDependences() |
|
| 229 | 229 | { |
| 230 | - return (bool) count ( $this->dependences ); |
|
| 230 | + return (bool) count($this->dependences); |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | /** |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | * |
| 236 | 236 | * @return \Classes\Db\Constrant[] |
| 237 | 237 | */ |
| 238 | - public function getPrimaryKey () |
|
| 238 | + public function getPrimaryKey() |
|
| 239 | 239 | { |
| 240 | 240 | return $this->primarykey; |
| 241 | 241 | } |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | /** |
| 244 | 244 | * |
| 245 | 245 | */ |
| 246 | - public function getMaxLength () |
|
| 246 | + public function getMaxLength() |
|
| 247 | 247 | { |
| 248 | 248 | return $this->max_length; |
| 249 | 249 | } |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | /** |
| 252 | 252 | * @return bool |
| 253 | 253 | */ |
| 254 | - public function hasSequence () |
|
| 254 | + public function hasSequence() |
|
| 255 | 255 | { |
| 256 | 256 | return (bool) $this->sequence; |
| 257 | 257 | } |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | /** |
| 260 | 260 | * @return string |
| 261 | 261 | */ |
| 262 | - public function getSequence () |
|
| 262 | + public function getSequence() |
|
| 263 | 263 | { |
| 264 | 264 | return $this->sequence; |
| 265 | 265 | } |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | /** |
| 268 | 268 | * @param string $sequence |
| 269 | 269 | */ |
| 270 | - public function setSequence ( $sequence ) |
|
| 270 | + public function setSequence($sequence) |
|
| 271 | 271 | { |
| 272 | 272 | $this->sequence = $sequence; |
| 273 | 273 | } |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | /** |
| 276 | 276 | * @return boolean |
| 277 | 277 | */ |
| 278 | - public function isNullable () |
|
| 278 | + public function isNullable() |
|
| 279 | 279 | { |
| 280 | 280 | return $this->nullable; |
| 281 | 281 | } |
@@ -21,11 +21,11 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * @author Pedro Alarcao <[email protected]> |
| 23 | 23 | */ |
| 24 | - final private function __construct () |
|
| 24 | + final private function __construct() |
|
| 25 | 25 | { |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - public static function getInstance () |
|
| 28 | + public static function getInstance() |
|
| 29 | 29 | { |
| 30 | 30 | return new self(); |
| 31 | 31 | } |
@@ -55,31 +55,31 @@ discard block |
||
| 55 | 55 | * |
| 56 | 56 | * @return Constrant |
| 57 | 57 | */ |
| 58 | - public function populate ( $array ) |
|
| 58 | + public function populate($array) |
|
| 59 | 59 | { |
| 60 | - if ( isset( $array[ 'schema' ] ) ) |
|
| 60 | + if (isset($array['schema'])) |
|
| 61 | 61 | { |
| 62 | - $this->schema = $array[ 'schema' ]; |
|
| 62 | + $this->schema = $array['schema']; |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - $this->constrant = $array[ 'constrant' ]; |
|
| 66 | - $this->table = $array[ 'table' ]; |
|
| 67 | - $this->column = $array[ 'column' ]; |
|
| 65 | + $this->constrant = $array['constrant']; |
|
| 66 | + $this->table = $array['table']; |
|
| 67 | + $this->column = $array['column']; |
|
| 68 | 68 | |
| 69 | 69 | return $this; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - public function getDatabase (){ } |
|
| 72 | + public function getDatabase() { } |
|
| 73 | 73 | |
| 74 | 74 | /** |
| 75 | 75 | * @return string |
| 76 | 76 | */ |
| 77 | - public function getNameConstrant () |
|
| 77 | + public function getNameConstrant() |
|
| 78 | 78 | { |
| 79 | 79 | return $this->constrant; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - public function hasSchema () |
|
| 82 | + public function hasSchema() |
|
| 83 | 83 | { |
| 84 | 84 | return (bool) $this->schema; |
| 85 | 85 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | /** |
| 88 | 88 | * @return string |
| 89 | 89 | */ |
| 90 | - public function getSchema () |
|
| 90 | + public function getSchema() |
|
| 91 | 91 | { |
| 92 | 92 | return $this->schema; |
| 93 | 93 | } |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | /** |
| 96 | 96 | * @return string |
| 97 | 97 | */ |
| 98 | - public function getTable () |
|
| 98 | + public function getTable() |
|
| 99 | 99 | { |
| 100 | 100 | return $this->table; |
| 101 | 101 | } |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | /** |
| 104 | 104 | * @return string |
| 105 | 105 | */ |
| 106 | - public function getColumn () |
|
| 106 | + public function getColumn() |
|
| 107 | 107 | { |
| 108 | 108 | return $this->column; |
| 109 | 109 | } |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | /** |
| 19 | 19 | * @type string[] |
| 20 | 20 | */ |
| 21 | - public $location = array (); |
|
| 21 | + public $location = array(); |
|
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | 24 | * caminho de pastas Base |
@@ -37,154 +37,154 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | private $driver; |
| 39 | 39 | |
| 40 | - public function __construct ( Config $config ) |
|
| 40 | + public function __construct(Config $config) |
|
| 41 | 41 | { |
| 42 | - $this->config = $config->getAdapterConfig (); |
|
| 43 | - $this->driver = $config->getAdapterDriver (); |
|
| 44 | - $this->parseLocation ( $config->_basePath ); |
|
| 42 | + $this->config = $config->getAdapterConfig(); |
|
| 43 | + $this->driver = $config->getAdapterDriver(); |
|
| 44 | + $this->parseLocation($config->_basePath); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * Analisa os caminhos das pastas base |
| 49 | 49 | */ |
| 50 | - public function parseLocation ( $basePath ) |
|
| 50 | + public function parseLocation($basePath) |
|
| 51 | 51 | { |
| 52 | 52 | |
| 53 | - $arrBase = array ( |
|
| 54 | - $basePath , |
|
| 53 | + $arrBase = array( |
|
| 54 | + $basePath, |
|
| 55 | 55 | $this->config->path |
| 56 | 56 | ); |
| 57 | 57 | |
| 58 | - $this->baseLocation = implode ( DIRECTORY_SEPARATOR , array_filter ( $arrBase ) ); |
|
| 58 | + $this->baseLocation = implode(DIRECTORY_SEPARATOR, array_filter($arrBase)); |
|
| 59 | 59 | |
| 60 | 60 | # pasta com nome do driver do banco |
| 61 | 61 | $driverBase = ''; |
| 62 | - if ( $this->config->{"folder-database"} ) |
|
| 62 | + if ($this->config->{"folder-database"} ) |
|
| 63 | 63 | { |
| 64 | - $classDriver = explode ( '\\' , get_class ( $this->driver ) ); |
|
| 65 | - $driverBase = end ( $classDriver ); |
|
| 64 | + $classDriver = explode('\\', get_class($this->driver)); |
|
| 65 | + $driverBase = end($classDriver); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - if ( $this->config->hasSchemas () ) |
|
| 68 | + if ($this->config->hasSchemas()) |
|
| 69 | 69 | { |
| 70 | 70 | |
| 71 | - $schemas = $this->config->getSchemas (); |
|
| 72 | - foreach ( $schemas as $schema ) |
|
| 71 | + $schemas = $this->config->getSchemas(); |
|
| 72 | + foreach ($schemas as $schema) |
|
| 73 | 73 | { |
| 74 | - $arrUrl = array ( |
|
| 75 | - $this->baseLocation , |
|
| 76 | - $driverBase , |
|
| 77 | - $this->getClassName ( $schema ) |
|
| 74 | + $arrUrl = array( |
|
| 75 | + $this->baseLocation, |
|
| 76 | + $driverBase, |
|
| 77 | + $this->getClassName($schema) |
|
| 78 | 78 | ); |
| 79 | 79 | |
| 80 | - $this->location[ $schema ] = implode ( DIRECTORY_SEPARATOR , array_filter ( $arrUrl ) ); |
|
| 81 | - unset( $arrUrl ); |
|
| 80 | + $this->location[$schema] = implode(DIRECTORY_SEPARATOR, array_filter($arrUrl)); |
|
| 81 | + unset($arrUrl); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | |
| 85 | 85 | } else |
| 86 | 86 | { |
| 87 | - $baseLocation = implode ( |
|
| 88 | - DIRECTORY_SEPARATOR , array_filter ( array ( |
|
| 89 | - $this->baseLocation , |
|
| 90 | - $driverBase , |
|
| 91 | - $this->getClassName ( $this->getConfig ()->getDatabase () ) |
|
| 87 | + $baseLocation = implode( |
|
| 88 | + DIRECTORY_SEPARATOR, array_filter(array( |
|
| 89 | + $this->baseLocation, |
|
| 90 | + $driverBase, |
|
| 91 | + $this->getClassName($this->getConfig()->getDatabase()) |
|
| 92 | 92 | ) |
| 93 | 93 | ) |
| 94 | 94 | ); |
| 95 | - $this->location = array ( $baseLocation ); |
|
| 95 | + $this->location = array($baseLocation); |
|
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /** |
| 100 | 100 | * @return AdapterConfig\AbstractAdapter |
| 101 | 101 | */ |
| 102 | - public function getConfig () |
|
| 102 | + public function getConfig() |
|
| 103 | 103 | { |
| 104 | 104 | return $this->config; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | /* Get current time */ |
| 108 | - public function startTime () |
|
| 108 | + public function startTime() |
|
| 109 | 109 | { |
| 110 | 110 | echo "Starting..\n"; |
| 111 | - $this->startTime = microtime ( true ); |
|
| 111 | + $this->startTime = microtime(true); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - private function getRunTime () |
|
| 114 | + private function getRunTime() |
|
| 115 | 115 | { |
| 116 | - return round ( ( microtime ( true ) - $this->startTime ) , 3 ); |
|
| 116 | + return round((microtime(true) - $this->startTime), 3); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | /** |
| 120 | 120 | * Executa o Make, criando arquivos e Diretorios |
| 121 | 121 | */ |
| 122 | - public function run () |
|
| 122 | + public function run() |
|
| 123 | 123 | { |
| 124 | - $this->startTime (); |
|
| 125 | - $this->driver->runDatabase (); |
|
| 126 | - $max = $this->driver->getTotalTables () * count ( $this->factoryMakerFile () ); |
|
| 124 | + $this->startTime(); |
|
| 125 | + $this->driver->runDatabase(); |
|
| 126 | + $max = $this->driver->getTotalTables() * count($this->factoryMakerFile()); |
|
| 127 | 127 | $cur = 0; |
| 128 | 128 | |
| 129 | 129 | |
| 130 | - foreach ( $this->location as $schema => $location ) |
|
| 130 | + foreach ($this->location as $schema => $location) |
|
| 131 | 131 | { |
| 132 | - foreach ( $this->factoryMakerFile () as $objMakeFile ) |
|
| 132 | + foreach ($this->factoryMakerFile() as $objMakeFile) |
|
| 133 | 133 | { |
| 134 | - $path = $location . DIRECTORY_SEPARATOR . $objMakeFile->getPastName (); |
|
| 135 | - self::makeDir ( $path ); |
|
| 134 | + $path = $location . DIRECTORY_SEPARATOR . $objMakeFile->getPastName(); |
|
| 135 | + self::makeDir($path); |
|
| 136 | 136 | |
| 137 | - if ( $objMakeFile->getParentFileTpl () != '' ) |
|
| 137 | + if ($objMakeFile->getParentFileTpl() != '') |
|
| 138 | 138 | { |
| 139 | 139 | $fileAbstract = $this->baseLocation |
| 140 | 140 | . DIRECTORY_SEPARATOR |
| 141 | - . $objMakeFile->getParentClass () . '.php'; |
|
| 141 | + . $objMakeFile->getParentClass() . '.php'; |
|
| 142 | 142 | |
| 143 | - $tplAbstract = $this->getParsedTplContents ( $objMakeFile->getParentFileTpl () ); |
|
| 144 | - self::makeSourcer ( $fileAbstract , $tplAbstract , $objMakeFile->isOverwrite () ); |
|
| 145 | - unset( $fileAbstract , $tplAbstract ); |
|
| 143 | + $tplAbstract = $this->getParsedTplContents($objMakeFile->getParentFileTpl()); |
|
| 144 | + self::makeSourcer($fileAbstract, $tplAbstract, $objMakeFile->isOverwrite()); |
|
| 145 | + unset($fileAbstract, $tplAbstract); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - foreach ( $this->driver->getTables ( $schema ) as $key => $objTables ) |
|
| 148 | + foreach ($this->driver->getTables($schema) as $key => $objTables) |
|
| 149 | 149 | { |
| 150 | - $total = ceil ( $cur / $max ) * 100; |
|
| 151 | - printf ( "\r Creating: %6.2f%%" , $total ); |
|
| 152 | - $cur ++; |
|
| 150 | + $total = ceil($cur / $max) * 100; |
|
| 151 | + printf("\r Creating: %6.2f%%", $total); |
|
| 152 | + $cur++; |
|
| 153 | 153 | |
| 154 | 154 | $file = $path |
| 155 | 155 | . DIRECTORY_SEPARATOR |
| 156 | - . self::getClassName ( $objTables->getName () ) |
|
| 156 | + . self::getClassName($objTables->getName()) |
|
| 157 | 157 | . '.php'; |
| 158 | 158 | |
| 159 | 159 | |
| 160 | - $tpl = $this->getParsedTplContents ( |
|
| 161 | - $objMakeFile->getFileTpl () , |
|
| 162 | - $objMakeFile->parseRelation ( $this , $objTables ) |
|
| 163 | - , $objTables , $objMakeFile |
|
| 160 | + $tpl = $this->getParsedTplContents( |
|
| 161 | + $objMakeFile->getFileTpl(), |
|
| 162 | + $objMakeFile->parseRelation($this, $objTables) |
|
| 163 | + , $objTables, $objMakeFile |
|
| 164 | 164 | |
| 165 | 165 | ); |
| 166 | - self::makeSourcer ( $file , $tpl , $objMakeFile->isOverwrite () ); |
|
| 166 | + self::makeSourcer($file, $tpl, $objMakeFile->isOverwrite()); |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - $this->reportProcess ( $cur ); |
|
| 172 | + $this->reportProcess($cur); |
|
| 173 | 173 | echo "\n\033[1;32mSuccessfully process finished!\n\033[0m"; |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | - private function reportProcess ( $countFiles ) |
|
| 176 | + private function reportProcess($countFiles) |
|
| 177 | 177 | { |
| 178 | - if ( $this->config->isStatusEnabled () ) |
|
| 178 | + if ($this->config->isStatusEnabled()) |
|
| 179 | 179 | { |
| 180 | - $databases = count ( $this->location ); |
|
| 181 | - $countDir = $this->countDiretory (); |
|
| 182 | - $totalTable = $this->driver->getTotalTables (); |
|
| 180 | + $databases = count($this->location); |
|
| 181 | + $countDir = $this->countDiretory(); |
|
| 182 | + $totalTable = $this->driver->getTotalTables(); |
|
| 183 | 183 | echo "\n------"; |
| 184 | - printf ( "\n\r-Files generated:%s" , $countFiles ); |
|
| 185 | - printf ( "\n\r-Diretory generated:%s" , $databases * $countDir ); |
|
| 186 | - printf ( "\n\r-Scanned tables:%s" , $totalTable ); |
|
| 187 | - printf ( "\n\r-Execution time: %ssec" , $this->getRunTime () ); |
|
| 184 | + printf("\n\r-Files generated:%s", $countFiles); |
|
| 185 | + printf("\n\r-Diretory generated:%s", $databases * $countDir); |
|
| 186 | + printf("\n\r-Scanned tables:%s", $totalTable); |
|
| 187 | + printf("\n\r-Execution time: %ssec", $this->getRunTime()); |
|
| 188 | 188 | echo "\n------"; |
| 189 | 189 | } |
| 190 | 190 | } |
@@ -194,9 +194,9 @@ discard block |
||
| 194 | 194 | * |
| 195 | 195 | * @return AbstractAdapter[] |
| 196 | 196 | */ |
| 197 | - public function factoryMakerFile () |
|
| 197 | + public function factoryMakerFile() |
|
| 198 | 198 | { |
| 199 | - return $this->config->getMakeFileInstances (); |
|
| 199 | + return $this->config->getMakeFileInstances(); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | /** |
@@ -204,14 +204,14 @@ discard block |
||
| 204 | 204 | * |
| 205 | 205 | * @return int |
| 206 | 206 | */ |
| 207 | - public function countDiretory () |
|
| 207 | + public function countDiretory() |
|
| 208 | 208 | { |
| 209 | 209 | $dir = 0; |
| 210 | - foreach ( $this->factoryMakerFile () as $abstractAdapter ) |
|
| 210 | + foreach ($this->factoryMakerFile() as $abstractAdapter) |
|
| 211 | 211 | { |
| 212 | - if ( $abstractAdapter->hasDiretory () ) |
|
| 212 | + if ($abstractAdapter->hasDiretory()) |
|
| 213 | 213 | { |
| 214 | - $dir ++; |
|
| 214 | + $dir++; |
|
| 215 | 215 | } |
| 216 | 216 | } |
| 217 | 217 | |
@@ -226,23 +226,23 @@ discard block |
||
| 226 | 226 | * |
| 227 | 227 | * @return String |
| 228 | 228 | */ |
| 229 | - protected function getParsedTplContents ( $tplFile , $vars = array () , \Classes\Db\DbTable $objTables = null , $objMakeFile = null ) |
|
| 229 | + protected function getParsedTplContents($tplFile, $vars = array(), \Classes\Db\DbTable $objTables = null, $objMakeFile = null) |
|
| 230 | 230 | { |
| 231 | 231 | |
| 232 | - $arrUrl = array ( |
|
| 233 | - __DIR__ , |
|
| 234 | - 'templates' , |
|
| 235 | - $this->config->framework , |
|
| 232 | + $arrUrl = array( |
|
| 233 | + __DIR__, |
|
| 234 | + 'templates', |
|
| 235 | + $this->config->framework, |
|
| 236 | 236 | $tplFile |
| 237 | 237 | ); |
| 238 | 238 | |
| 239 | - $filePath = implode ( DIRECTORY_SEPARATOR , filter_var_array ( $arrUrl ) ); |
|
| 239 | + $filePath = implode(DIRECTORY_SEPARATOR, filter_var_array($arrUrl)); |
|
| 240 | 240 | |
| 241 | - extract ( $vars ); |
|
| 242 | - ob_start (); |
|
| 241 | + extract($vars); |
|
| 242 | + ob_start(); |
|
| 243 | 243 | require $filePath; |
| 244 | - $data = ob_get_contents (); |
|
| 245 | - ob_end_clean (); |
|
| 244 | + $data = ob_get_contents(); |
|
| 245 | + ob_end_clean(); |
|
| 246 | 246 | |
| 247 | 247 | return $data; |
| 248 | 248 | } |
@@ -46,6 +46,7 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * Analisa os caminhos das pastas base |
| 49 | + * @param string $basePath |
|
| 49 | 50 | */ |
| 50 | 51 | public function parseLocation ( $basePath ) |
| 51 | 52 | { |
@@ -173,6 +174,9 @@ discard block |
||
| 173 | 174 | echo "\n\033[1;32mSuccessfully process finished!\n\033[0m"; |
| 174 | 175 | } |
| 175 | 176 | |
| 177 | + /** |
|
| 178 | + * @param integer $countFiles |
|
| 179 | + */ |
|
| 176 | 180 | private function reportProcess ( $countFiles ) |
| 177 | 181 | { |
| 178 | 182 | if ( $this->config->isStatusEnabled () ) |
@@ -223,6 +227,7 @@ discard block |
||
| 223 | 227 | * parse a tpl file and return the result |
| 224 | 228 | * |
| 225 | 229 | * @param String $tplFile |
| 230 | + * @param AbstractAdapter $objMakeFile |
|
| 226 | 231 | * |
| 227 | 232 | * @return String |
| 228 | 233 | */ |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | protected $fileTpl = "entity.php"; |
| 23 | 23 | protected $overwrite = true; |
| 24 | 24 | |
| 25 | - protected $validFunc = array (); |
|
| 25 | + protected $validFunc = array(); |
|
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | 28 | * @param \Classes\MakerFile $makerFile |
@@ -30,68 +30,68 @@ discard block |
||
| 30 | 30 | * |
| 31 | 31 | * @return array |
| 32 | 32 | */ |
| 33 | - public function parseRelation ( \Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable ) |
|
| 33 | + public function parseRelation(\Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable) |
|
| 34 | 34 | { |
| 35 | 35 | |
| 36 | - $parents = array (); |
|
| 37 | - $depends = array (); |
|
| 38 | - foreach ( $dbTable->getForeingkeys () as $fks ) |
|
| 36 | + $parents = array(); |
|
| 37 | + $depends = array(); |
|
| 38 | + foreach ($dbTable->getForeingkeys() as $fks) |
|
| 39 | 39 | { |
| 40 | - $constrant = $fks->getFks (); |
|
| 40 | + $constrant = $fks->getFks(); |
|
| 41 | 41 | $name = |
| 42 | 42 | 'Parent' |
| 43 | 43 | . ZendFrameworkOne::SEPARETOR |
| 44 | - . AbstractMaker::getClassName ( $constrant->getTable () ) |
|
| 44 | + . AbstractMaker::getClassName($constrant->getTable()) |
|
| 45 | 45 | . ZendFrameworkOne::SEPARETOR |
| 46 | 46 | . 'By' |
| 47 | 47 | . ZendFrameworkOne::SEPARETOR |
| 48 | 48 | . $fks->getName(); |
| 49 | 49 | |
| 50 | - $parents[] = array ( |
|
| 51 | - 'class' => $makerFile->getConfig () |
|
| 52 | - ->createClassNamespace ( $constrant ) |
|
| 50 | + $parents[] = array( |
|
| 51 | + 'class' => $makerFile->getConfig() |
|
| 52 | + ->createClassNamespace($constrant) |
|
| 53 | 53 | . ZendFrameworkOne::SEPARETOR |
| 54 | - . AbstractMaker::getClassName ( $constrant->getTable () ), |
|
| 55 | - 'function' => AbstractMaker::getClassName ( $name ), |
|
| 56 | - 'table' => $constrant->getTable (), |
|
| 57 | - 'column' => $fks->getName (), |
|
| 58 | - 'name' => $constrant->getNameConstrant (), |
|
| 54 | + . AbstractMaker::getClassName($constrant->getTable()), |
|
| 55 | + 'function' => AbstractMaker::getClassName($name), |
|
| 56 | + 'table' => $constrant->getTable(), |
|
| 57 | + 'column' => $fks->getName(), |
|
| 58 | + 'name' => $constrant->getNameConstrant(), |
|
| 59 | 59 | ); |
| 60 | - unset( $name ); |
|
| 60 | + unset($name); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - foreach ( $dbTable->getDependences () as $objColumn ) |
|
| 63 | + foreach ($dbTable->getDependences() as $objColumn) |
|
| 64 | 64 | { |
| 65 | - foreach ( $objColumn->getDependences () as $dependence ) |
|
| 65 | + foreach ($objColumn->getDependences() as $dependence) |
|
| 66 | 66 | { |
| 67 | 67 | $name = |
| 68 | 68 | 'Depend' |
| 69 | 69 | . ZendFrameworkOne::SEPARETOR |
| 70 | - . AbstractMaker::getClassName ( $dependence->getTable () ) |
|
| 70 | + . AbstractMaker::getClassName($dependence->getTable()) |
|
| 71 | 71 | . ZendFrameworkOne::SEPARETOR |
| 72 | 72 | . 'By' |
| 73 | 73 | . ZendFrameworkOne::SEPARETOR |
| 74 | 74 | . $fks->getName(); |
| 75 | 75 | |
| 76 | - if ( !key_exists ( $name, $this->validFunc ) ) |
|
| 76 | + if ( ! key_exists($name, $this->validFunc)) |
|
| 77 | 77 | { |
| 78 | - $this->validFunc[ $name ] = true; |
|
| 79 | - $depends[] = array ( |
|
| 80 | - 'class' => $makerFile->getConfig () |
|
| 81 | - ->createClassNamespace ( $dependence ) |
|
| 78 | + $this->validFunc[$name] = true; |
|
| 79 | + $depends[] = array( |
|
| 80 | + 'class' => $makerFile->getConfig() |
|
| 81 | + ->createClassNamespace($dependence) |
|
| 82 | 82 | . ZendFrameworkOne::SEPARETOR |
| 83 | - . AbstractMaker::getClassName ( $dependence->getTable () ), |
|
| 84 | - 'function' => AbstractMaker::getClassName ( $name ), |
|
| 85 | - 'table' => $dependence->getTable (), |
|
| 86 | - 'column' => $dependence->getColumn (), |
|
| 87 | - 'name' => $dependence->getNameConstrant () |
|
| 83 | + . AbstractMaker::getClassName($dependence->getTable()), |
|
| 84 | + 'function' => AbstractMaker::getClassName($name), |
|
| 85 | + 'table' => $dependence->getTable(), |
|
| 86 | + 'column' => $dependence->getColumn(), |
|
| 87 | + 'name' => $dependence->getNameConstrant() |
|
| 88 | 88 | ); |
| 89 | 89 | } |
| 90 | - unset( $name ); |
|
| 90 | + unset($name); |
|
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - return array ( |
|
| 94 | + return array( |
|
| 95 | 95 | 'parents' => $parents, |
| 96 | 96 | 'depends' => $depends |
| 97 | 97 | ); |