@@ -54,7 +54,6 @@ |
||
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | 56 | * @inheritDoc |
| 57 | - * @param string $databaseName |
|
| 58 | 57 | * @return \Classes\Db\DbTable[] |
| 59 | 58 | */ |
| 60 | 59 | public function getTables($schema = 0) |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * |
| 79 | 79 | * @return array[] |
| 80 | 80 | */ |
| 81 | - public function getListColumns () |
|
| 81 | + public function getListColumns() |
|
| 82 | 82 | { |
| 83 | 83 | // TODO: Implement getListColumns() method. |
| 84 | 84 | } |
@@ -88,17 +88,17 @@ discard block |
||
| 88 | 88 | * |
| 89 | 89 | * @return int |
| 90 | 90 | */ |
| 91 | - public function getTotalTables () |
|
| 91 | + public function getTotalTables() |
|
| 92 | 92 | { |
| 93 | 93 | // TODO: Implement totalTables() method. |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - public function getSequence ( $table , $column ) |
|
| 96 | + public function getSequence($table, $column) |
|
| 97 | 97 | { |
| 98 | 98 | // TODO: Implement getSequence() method. |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - public function getListConstrant () |
|
| 101 | + public function getListConstrant() |
|
| 102 | 102 | { |
| 103 | 103 | // TODO: Implement getListConstrant() method. |
| 104 | 104 | } |
@@ -220,7 +220,7 @@ |
||
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | /** |
| 223 | - * @param string $Namespace |
|
| 223 | + * @param string $namespace |
|
| 224 | 224 | */ |
| 225 | 225 | public function setNamespace ( $namespace ) |
| 226 | 226 | { |
@@ -11,14 +11,14 @@ discard block |
||
| 11 | 11 | /** |
| 12 | 12 | * @author Pedro Alarcao <[email protected]> |
| 13 | 13 | */ |
| 14 | - final private function __construct () |
|
| 14 | + final private function __construct() |
|
| 15 | 15 | { |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * @return \Classes\Db\DbTable |
| 20 | 20 | */ |
| 21 | - public static function getInstance(){ |
|
| 21 | + public static function getInstance() { |
|
| 22 | 22 | return new self(); |
| 23 | 23 | } |
| 24 | 24 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | /** |
| 41 | 41 | * @var \Classes\Db\Column[] |
| 42 | 42 | */ |
| 43 | - private $columns = array (); |
|
| 43 | + private $columns = array(); |
|
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | 46 | * @var string |
@@ -50,25 +50,25 @@ discard block |
||
| 50 | 50 | /** |
| 51 | 51 | * @type \Classes\Db\Column[] |
| 52 | 52 | */ |
| 53 | - private $primarykeys = array (); |
|
| 53 | + private $primarykeys = array(); |
|
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | 56 | * @type \Classes\Db\Column[] |
| 57 | 57 | */ |
| 58 | - private $foreingkeys = array (); |
|
| 58 | + private $foreingkeys = array(); |
|
| 59 | 59 | |
| 60 | - private $dependence = array (); |
|
| 60 | + private $dependence = array(); |
|
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | 63 | * @type string[] |
| 64 | 64 | */ |
| 65 | - private $sequence = array (); |
|
| 65 | + private $sequence = array(); |
|
| 66 | 66 | |
| 67 | - public function populate ( $array ) |
|
| 67 | + public function populate($array) |
|
| 68 | 68 | { |
| 69 | - $this->name = $array[ 'table' ]; |
|
| 70 | - $this->schema = isset( $array[ 'schema' ] ) ? $array[ 'schema' ] : null; |
|
| 71 | - $this->database = $array[ 'database' ]; |
|
| 69 | + $this->name = $array['table']; |
|
| 70 | + $this->schema = isset($array['schema']) ? $array['schema'] : null; |
|
| 71 | + $this->database = $array['database']; |
|
| 72 | 72 | |
| 73 | 73 | return $this; |
| 74 | 74 | } |
@@ -78,9 +78,9 @@ discard block |
||
| 78 | 78 | * |
| 79 | 79 | * @param \Classes\Db\Column $column |
| 80 | 80 | */ |
| 81 | - public function addColumn ( Column $column ) |
|
| 81 | + public function addColumn(Column $column) |
|
| 82 | 82 | { |
| 83 | - $this->columns[ $column->getName () ] = $column; |
|
| 83 | + $this->columns[$column->getName()] = $column; |
|
| 84 | 84 | |
| 85 | 85 | return $this; |
| 86 | 86 | } |
@@ -90,24 +90,24 @@ discard block |
||
| 90 | 90 | * |
| 91 | 91 | * @return \Classes\Db\Column |
| 92 | 92 | */ |
| 93 | - public function getColumn ( $columnName ) |
|
| 93 | + public function getColumn($columnName) |
|
| 94 | 94 | { |
| 95 | - return $this->columns[ $columnName ]; |
|
| 95 | + return $this->columns[$columnName]; |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - public function hasColumn ( $columnName ) |
|
| 98 | + public function hasColumn($columnName) |
|
| 99 | 99 | { |
| 100 | - return isset( $this->columns[ $columnName ] ); |
|
| 100 | + return isset($this->columns[$columnName]); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
| 104 | 104 | * @return \Classes\Db\Column[] |
| 105 | 105 | */ |
| 106 | - public function getPrimaryKeys () |
|
| 106 | + public function getPrimaryKeys() |
|
| 107 | 107 | { |
| 108 | - if ( empty ( $this->primarykeys ) ) |
|
| 108 | + if (empty ($this->primarykeys)) |
|
| 109 | 109 | { |
| 110 | - $this->primarykeys = array_filter ( $this->columns , function ( $column ){ return $column->isPrimaryKey (); } ); |
|
| 110 | + $this->primarykeys = array_filter($this->columns, function($column) { return $column->isPrimaryKey(); } ); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | return $this->primarykeys; |
@@ -116,25 +116,25 @@ discard block |
||
| 116 | 116 | /** |
| 117 | 117 | * @return bool |
| 118 | 118 | */ |
| 119 | - public function hasPrimaryKey () |
|
| 119 | + public function hasPrimaryKey() |
|
| 120 | 120 | { |
| 121 | - if ( empty ( $this->sequence ) ) |
|
| 121 | + if (empty ($this->sequence)) |
|
| 122 | 122 | { |
| 123 | - $this->getPrimaryKeys (); |
|
| 123 | + $this->getPrimaryKeys(); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - return ! empty ( $this->sequence ); |
|
| 126 | + return ! empty ($this->sequence); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /** |
| 130 | 130 | * @return \Classes\Db\Column[] |
| 131 | 131 | */ |
| 132 | - public function getForeingkeys () |
|
| 132 | + public function getForeingkeys() |
|
| 133 | 133 | { |
| 134 | 134 | |
| 135 | - if ( empty ( $this->foreingkeys ) ) |
|
| 135 | + if (empty ($this->foreingkeys)) |
|
| 136 | 136 | { |
| 137 | - $this->foreingkeys = array_filter ( $this->columns , function ( $column ){ return $column->isForeingkey (); } ); |
|
| 137 | + $this->foreingkeys = array_filter($this->columns, function($column) { return $column->isForeingkey(); } ); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | return $this->foreingkeys; |
@@ -144,11 +144,11 @@ discard block |
||
| 144 | 144 | /** |
| 145 | 145 | * @return \Classes\Db\Column[] |
| 146 | 146 | */ |
| 147 | - public function getDependences () |
|
| 147 | + public function getDependences() |
|
| 148 | 148 | { |
| 149 | - if ( empty ( $this->dependence ) ) |
|
| 149 | + if (empty ($this->dependence)) |
|
| 150 | 150 | { |
| 151 | - $this->dependence = array_filter ( $this->columns , function ( $column ){ return $column->hasDependence (); } ); |
|
| 151 | + $this->dependence = array_filter($this->columns, function($column) { return $column->hasDependence(); } ); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | return $this->dependence; |
@@ -157,11 +157,11 @@ discard block |
||
| 157 | 157 | /** |
| 158 | 158 | * @return string[] |
| 159 | 159 | */ |
| 160 | - public function getSequences () |
|
| 160 | + public function getSequences() |
|
| 161 | 161 | { |
| 162 | - if ( empty ( $this->sequence ) ) |
|
| 162 | + if (empty ($this->sequence)) |
|
| 163 | 163 | { |
| 164 | - $this->sequence = array_filter ( $this->columns , function ( $column ){ return $column->hasSequence (); } ); |
|
| 164 | + $this->sequence = array_filter($this->columns, function($column) { return $column->hasSequence(); } ); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | return $this->sequence; |
@@ -170,20 +170,20 @@ discard block |
||
| 170 | 170 | /** |
| 171 | 171 | * @return bool |
| 172 | 172 | */ |
| 173 | - public function hasSequences () |
|
| 173 | + public function hasSequences() |
|
| 174 | 174 | { |
| 175 | - if ( empty ( $this->sequence ) ) |
|
| 175 | + if (empty ($this->sequence)) |
|
| 176 | 176 | { |
| 177 | - $this->getSequences (); |
|
| 177 | + $this->getSequences(); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - return ! empty ( $this->sequence ); |
|
| 180 | + return ! empty ($this->sequence); |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | /** |
| 184 | 184 | * @return \Classes\Db\Column[] |
| 185 | 185 | */ |
| 186 | - public function getColumns () |
|
| 186 | + public function getColumns() |
|
| 187 | 187 | { |
| 188 | 188 | return $this->columns; |
| 189 | 189 | } |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | /** |
| 192 | 192 | * @return string |
| 193 | 193 | */ |
| 194 | - public function getName () |
|
| 194 | + public function getName() |
|
| 195 | 195 | { |
| 196 | 196 | return $this->name; |
| 197 | 197 | } |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | /** |
| 200 | 200 | * @return string |
| 201 | 201 | */ |
| 202 | - public function getSchema () |
|
| 202 | + public function getSchema() |
|
| 203 | 203 | { |
| 204 | 204 | return $this->schema; |
| 205 | 205 | } |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | /** |
| 208 | 208 | * @return bool |
| 209 | 209 | */ |
| 210 | - public function hasSchema () |
|
| 210 | + public function hasSchema() |
|
| 211 | 211 | { |
| 212 | 212 | return (bool) $this->schema; |
| 213 | 213 | } |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | /** |
| 216 | 216 | * @return string |
| 217 | 217 | */ |
| 218 | - public function getDatabase () |
|
| 218 | + public function getDatabase() |
|
| 219 | 219 | { |
| 220 | 220 | return $this->database; |
| 221 | 221 | } |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | /** |
| 224 | 224 | * @return string |
| 225 | 225 | */ |
| 226 | - public function getNamespace () |
|
| 226 | + public function getNamespace() |
|
| 227 | 227 | { |
| 228 | 228 | return $this->namespace; |
| 229 | 229 | } |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | /** |
| 232 | 232 | * @param string $Namespace |
| 233 | 233 | */ |
| 234 | - public function setNamespace ( $namespace ) |
|
| 234 | + public function setNamespace($namespace) |
|
| 235 | 235 | { |
| 236 | 236 | $this->namespace = $namespace; |
| 237 | 237 | } |
@@ -44,7 +44,6 @@ |
||
| 44 | 44 | /** |
| 45 | 45 | * Analisa e estrutura a Configuracao do generate |
| 46 | 46 | * |
| 47 | - * @param string $_path |
|
| 48 | 47 | * @param array $argv |
| 49 | 48 | * |
| 50 | 49 | * @return array |
@@ -24,21 +24,21 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | private $msg = "\033[0mPlease enter the value for %index% \033[1;33m[%config%]:\033[0m "; |
| 26 | 26 | |
| 27 | - private $configs = array ( |
|
| 28 | - 'config-env' => 'config' , |
|
| 29 | - 'framework' => 'none' , |
|
| 30 | - 'driver' => 'pgsql' , |
|
| 31 | - 'environment' => 'dev' , |
|
| 32 | - 'host' => 'localhost' , |
|
| 33 | - 'database' => null , |
|
| 34 | - 'schema' => null , |
|
| 35 | - 'username' => null , |
|
| 27 | + private $configs = array( |
|
| 28 | + 'config-env' => 'config', |
|
| 29 | + 'framework' => 'none', |
|
| 30 | + 'driver' => 'pgsql', |
|
| 31 | + 'environment' => 'dev', |
|
| 32 | + 'host' => 'localhost', |
|
| 33 | + 'database' => null, |
|
| 34 | + 'schema' => null, |
|
| 35 | + 'username' => null, |
|
| 36 | 36 | 'password' => null |
| 37 | 37 | ); |
| 38 | 38 | |
| 39 | - public function __construct ( $argv , $basePath ) |
|
| 39 | + public function __construct($argv, $basePath) |
|
| 40 | 40 | { |
| 41 | - $this->argv = $this->parseConfig ( $basePath , $argv ); |
|
| 41 | + $this->argv = $this->parseConfig($basePath, $argv); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -50,32 +50,32 @@ discard block |
||
| 50 | 50 | * @return array |
| 51 | 51 | * @throws \Exception |
| 52 | 52 | */ |
| 53 | - private function parseConfig ( $basePath , $argv ) |
|
| 53 | + private function parseConfig($basePath, $argv) |
|
| 54 | 54 | { |
| 55 | - $this->baseLocation = dirname ( $basePath ); |
|
| 55 | + $this->baseLocation = dirname($basePath); |
|
| 56 | 56 | |
| 57 | - $arrayIO = array_diff_key ( $this->configs , $argv ); |
|
| 58 | - foreach ( $arrayIO as $index => $config ) |
|
| 57 | + $arrayIO = array_diff_key($this->configs, $argv); |
|
| 58 | + foreach ($arrayIO as $index => $config) |
|
| 59 | 59 | { |
| 60 | - $attribs = array ( "%index%" => $index , "%config%" => $config ); |
|
| 61 | - echo strtr ( $this->msg , $attribs ); |
|
| 62 | - $line = trim ( fgets ( STDIN ) ); |
|
| 63 | - if ( ! empty( $line ) ) |
|
| 60 | + $attribs = array("%index%" => $index, "%config%" => $config); |
|
| 61 | + echo strtr($this->msg, $attribs); |
|
| 62 | + $line = trim(fgets(STDIN)); |
|
| 63 | + if ( ! empty($line)) |
|
| 64 | 64 | { |
| 65 | - $this->configs[ $index ] = strtolower ( $line ); |
|
| 65 | + $this->configs[$index] = strtolower($line); |
|
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | - $this->configs ['version'] = Config::$version; |
|
| 69 | - return $argv + array_filter ( $this->configs ); |
|
| 68 | + $this->configs ['version'] = Config::$version; |
|
| 69 | + return $argv + array_filter($this->configs); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - public function run () |
|
| 72 | + public function run() |
|
| 73 | 73 | { |
| 74 | 74 | $path = $this->baseLocation . DIRECTORY_SEPARATOR . "configs"; |
| 75 | - self::makeDir ( $path ); |
|
| 76 | - self::makeSourcer ( |
|
| 77 | - $path . DIRECTORY_SEPARATOR . $this->argv[ 'config-env' ] . '.ini' , |
|
| 78 | - $this->getParsedTplContents ( $this->template , $this->argv ) |
|
| 75 | + self::makeDir($path); |
|
| 76 | + self::makeSourcer( |
|
| 77 | + $path . DIRECTORY_SEPARATOR . $this->argv['config-env'] . '.ini', |
|
| 78 | + $this->getParsedTplContents($this->template, $this->argv) |
|
| 79 | 79 | ); |
| 80 | 80 | echo "\n\033[1;32mSuccessfully process finished!\n\033[0m"; |
| 81 | 81 | } |
@@ -1,22 +1,22 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if ( ! ini_get ( 'short_open_tag' ) ) |
|
| 3 | +if ( ! ini_get('short_open_tag')) |
|
| 4 | 4 | { |
| 5 | - die( "please enable short_open_tag directive in php.ini\n" ); |
|
| 5 | + die("please enable short_open_tag directive in php.ini\n"); |
|
| 6 | 6 | } |
| 7 | 7 | |
| 8 | -if ( ! ini_get ( 'register_argc_argv' ) ) |
|
| 8 | +if ( ! ini_get('register_argc_argv')) |
|
| 9 | 9 | { |
| 10 | - die( "please enable register_argc_argv directive in php.ini\n" ); |
|
| 10 | + die("please enable register_argc_argv directive in php.ini\n"); |
|
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | if (function_exists('ini_set')) { |
| 14 | 14 | @ini_set('display_errors', 1); |
| 15 | 15 | |
| 16 | - $memoryInBytes = function ($value) { |
|
| 16 | + $memoryInBytes = function($value) { |
|
| 17 | 17 | $unit = strtolower(substr($value, -1, 1)); |
| 18 | 18 | $value = (int) $value; |
| 19 | - switch($unit) { |
|
| 19 | + switch ($unit) { |
|
| 20 | 20 | case 'g': |
| 21 | 21 | $value *= 1024; |
| 22 | 22 | // no break (cumulative multiplier) |
@@ -38,14 +38,14 @@ discard block |
||
| 38 | 38 | unset($memoryInBytes, $memoryLimit); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | -\Phar::interceptFileFuncs (); |
|
| 41 | +\Phar::interceptFileFuncs(); |
|
| 42 | 42 | |
| 43 | -set_include_path ( |
|
| 44 | - implode ( |
|
| 45 | - PATH_SEPARATOR , |
|
| 46 | - array ( |
|
| 47 | - realpath ( __DIR__ ) , |
|
| 48 | - get_include_path () , |
|
| 43 | +set_include_path( |
|
| 44 | + implode( |
|
| 45 | + PATH_SEPARATOR, |
|
| 46 | + array( |
|
| 47 | + realpath(__DIR__), |
|
| 48 | + get_include_path(), |
|
| 49 | 49 | ) |
| 50 | 50 | ) |
| 51 | 51 | ); |
@@ -56,43 +56,43 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | try |
| 58 | 58 | { |
| 59 | - $_path = realpath ( |
|
| 60 | - str_replace ( |
|
| 59 | + $_path = realpath( |
|
| 60 | + str_replace( |
|
| 61 | 61 | 'phar://' |
| 62 | - , '' , __DIR__ |
|
| 62 | + , '', __DIR__ |
|
| 63 | 63 | ) |
| 64 | 64 | ); |
| 65 | 65 | |
| 66 | - $arrValid = array ( |
|
| 67 | - 'version' , |
|
| 68 | - 'help' , |
|
| 69 | - 'status' , |
|
| 70 | - 'init' , |
|
| 71 | - 'config-env:' , |
|
| 72 | - 'config-ini:' , |
|
| 73 | - 'database:' , |
|
| 74 | - 'schema:' , |
|
| 75 | - 'driver:' , |
|
| 76 | - 'framework:' , |
|
| 66 | + $arrValid = array( |
|
| 67 | + 'version', |
|
| 68 | + 'help', |
|
| 69 | + 'status', |
|
| 70 | + 'init', |
|
| 71 | + 'config-env:', |
|
| 72 | + 'config-ini:', |
|
| 73 | + 'database:', |
|
| 74 | + 'schema:', |
|
| 75 | + 'driver:', |
|
| 76 | + 'framework:', |
|
| 77 | 77 | 'path:' |
| 78 | 78 | ); |
| 79 | 79 | |
| 80 | - $argv = getopt ( null, $arrValid ); |
|
| 80 | + $argv = getopt(null, $arrValid); |
|
| 81 | 81 | |
| 82 | - if ( array_key_exists ( 'init', $argv ) ) |
|
| 82 | + if (array_key_exists('init', $argv)) |
|
| 83 | 83 | { |
| 84 | - $maker = new \Classes\MakerConfigFile( $argv, $_path ); |
|
| 84 | + $maker = new \Classes\MakerConfigFile($argv, $_path); |
|
| 85 | 85 | } |
| 86 | 86 | else |
| 87 | 87 | { |
| 88 | - $maker = new \Classes\MakerFile( new \Classes\Config( $argv, $_path ) ); |
|
| 88 | + $maker = new \Classes\MakerFile(new \Classes\Config($argv, $_path)); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - $maker->run (); |
|
| 91 | + $maker->run(); |
|
| 92 | 92 | |
| 93 | -} catch ( \Exception $e ) |
|
| 93 | +} catch (\Exception $e) |
|
| 94 | 94 | { |
| 95 | - die( $e->getMessage () ); |
|
| 95 | + die($e->getMessage()); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | __halt_compiler(); |
| 99 | 99 | \ No newline at end of file |
@@ -82,8 +82,7 @@ |
||
| 82 | 82 | if ( array_key_exists ( 'init', $argv ) ) |
| 83 | 83 | { |
| 84 | 84 | $maker = new \Classes\MakerConfigFile( $argv, $_path ); |
| 85 | - } |
|
| 86 | - else |
|
| 85 | + } else |
|
| 87 | 86 | { |
| 88 | 87 | $maker = new \Classes\MakerFile( new \Classes\Config( $argv, $_path ) ); |
| 89 | 88 | } |
@@ -298,8 +298,8 @@ |
||
| 298 | 298 | public function getSequence ( $table , $column ) |
| 299 | 299 | { |
| 300 | 300 | $return = $this->getPDO () |
| 301 | - ->query ( "select * from information_schema.columns where extra like '%auto_increment%' and TABLE_SCHEMA='{$this->database}' AND TABLE_NAME='{$table}' AND COLUMN_NAME='{$column}';" ) |
|
| 302 | - ->fetch ( \PDO::FETCH_ASSOC ); |
|
| 301 | + ->query ( "select * from information_schema.columns where extra like '%auto_increment%' and TABLE_SCHEMA='{$this->database}' AND TABLE_NAME='{$table}' AND COLUMN_NAME='{$column}';" ) |
|
| 302 | + ->fetch ( \PDO::FETCH_ASSOC ); |
|
| 303 | 303 | |
| 304 | 304 | if ( ! $return ) |
| 305 | 305 | { |
@@ -30,21 +30,21 @@ discard block |
||
| 30 | 30 | * |
| 31 | 31 | * @return string |
| 32 | 32 | */ |
| 33 | - protected function convertTypeToPhp ( $str ) |
|
| 33 | + protected function convertTypeToPhp($str) |
|
| 34 | 34 | { |
| 35 | 35 | $res = ''; |
| 36 | - if ( preg_match ( '/(tinyint\(1\)|bit)/' , $str ) ) |
|
| 36 | + if (preg_match('/(tinyint\(1\)|bit)/', $str)) |
|
| 37 | 37 | { |
| 38 | 38 | $res = 'boolean'; |
| 39 | - } elseif ( preg_match ( '/(datetime|timestamp|blob|char|enum|text|date)/' , $str ) ) |
|
| 39 | + } elseif (preg_match('/(datetime|timestamp|blob|char|enum|text|date)/', $str)) |
|
| 40 | 40 | { |
| 41 | 41 | $res = 'string'; |
| 42 | - } elseif ( preg_match ( '/(decimal|numeric|float|double)/' , $str ) ) |
|
| 42 | + } elseif (preg_match('/(decimal|numeric|float|double)/', $str)) |
|
| 43 | 43 | { |
| 44 | 44 | $res = 'float'; |
| 45 | - } elseif ( preg_match ( '#^(?:tiny|small|medium|long|big|var)?(\w+)(?:\(\d+\))?(?:\s\w+)*$#' , $str , $matches ) ) |
|
| 45 | + } elseif (preg_match('#^(?:tiny|small|medium|long|big|var)?(\w+)(?:\(\d+\))?(?:\s\w+)*$#', $str, $matches)) |
|
| 46 | 46 | { |
| 47 | - $res = $matches[ 1 ]; |
|
| 47 | + $res = $matches[1]; |
|
| 48 | 48 | } else |
| 49 | 49 | { |
| 50 | 50 | print "Can't convert column type to PHP - Unrecognized type: $str"; |
@@ -57,12 +57,12 @@ discard block |
||
| 57 | 57 | * @inheritDoc |
| 58 | 58 | * @return string |
| 59 | 59 | */ |
| 60 | - public function getPDOString () |
|
| 60 | + public function getPDOString() |
|
| 61 | 61 | { |
| 62 | - return sprintf ( |
|
| 63 | - "mysql:host=%s;port=%s;dbname=%s" , |
|
| 64 | - $this->host , |
|
| 65 | - $this->port , |
|
| 62 | + return sprintf( |
|
| 63 | + "mysql:host=%s;port=%s;dbname=%s", |
|
| 64 | + $this->host, |
|
| 65 | + $this->port, |
|
| 66 | 66 | $this->database |
| 67 | 67 | |
| 68 | 68 | ); |
@@ -72,11 +72,11 @@ discard block |
||
| 72 | 72 | * @inheritDoc |
| 73 | 73 | * @return string |
| 74 | 74 | */ |
| 75 | - public function getPDOSocketString () |
|
| 75 | + public function getPDOSocketString() |
|
| 76 | 76 | { |
| 77 | - return sprintf ( |
|
| 78 | - "mysql:unix_socket=%s;dbname=%s" , |
|
| 79 | - $this->socket , |
|
| 77 | + return sprintf( |
|
| 78 | + "mysql:unix_socket=%s;dbname=%s", |
|
| 79 | + $this->socket, |
|
| 80 | 80 | $this->database |
| 81 | 81 | |
| 82 | 82 | ); |
@@ -86,13 +86,13 @@ discard block |
||
| 86 | 86 | * @inheritDoc |
| 87 | 87 | * @return string[] |
| 88 | 88 | */ |
| 89 | - public function getListNameTable () |
|
| 89 | + public function getListNameTable() |
|
| 90 | 90 | { |
| 91 | - if ( empty( $this->tableList ) ) |
|
| 91 | + if (empty($this->tableList)) |
|
| 92 | 92 | { |
| 93 | - $this->tableList = $this->getPDO ()->query ( |
|
| 93 | + $this->tableList = $this->getPDO()->query( |
|
| 94 | 94 | "show tables" |
| 95 | - )->fetchAll (); |
|
| 95 | + )->fetchAll(); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | return $this->tableList; |
@@ -103,10 +103,10 @@ discard block |
||
| 103 | 103 | * |
| 104 | 104 | * @return array[] |
| 105 | 105 | */ |
| 106 | - public function getListColumns () |
|
| 106 | + public function getListColumns() |
|
| 107 | 107 | { |
| 108 | 108 | |
| 109 | - return $this->getPDO ()->query ( |
|
| 109 | + return $this->getPDO()->query( |
|
| 110 | 110 | "select |
| 111 | 111 | 0 AS table_schema, |
| 112 | 112 | table_name, |
@@ -117,15 +117,15 @@ discard block |
||
| 117 | 117 | from information_schema.columns |
| 118 | 118 | where table_schema IN ('{$this->database}') |
| 119 | 119 | order by table_name,ordinal_position" |
| 120 | - )->fetchAll ( \PDO::FETCH_ASSOC ); |
|
| 120 | + )->fetchAll(\PDO::FETCH_ASSOC); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | /** |
| 124 | 124 | * @return array |
| 125 | 125 | */ |
| 126 | - public function getListConstrant () |
|
| 126 | + public function getListConstrant() |
|
| 127 | 127 | { |
| 128 | - return $this->getPDO ()->query ( |
|
| 128 | + return $this->getPDO()->query( |
|
| 129 | 129 | "SELECT distinct |
| 130 | 130 | i.constraint_type, |
| 131 | 131 | k.constraint_name, |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | WHERE |
| 143 | 143 | i.TABLE_SCHEMA IN ('{$this->database}') AND i.CONSTRAINT_TYPE IN ('FOREIGN KEY', 'PRIMARY KEY' ) |
| 144 | 144 | order by k.table_schema, k.table_name;" |
| 145 | - )->fetchAll ( \PDO::FETCH_ASSOC ); |
|
| 145 | + )->fetchAll(\PDO::FETCH_ASSOC); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | /** |
@@ -150,14 +150,14 @@ discard block |
||
| 150 | 150 | * |
| 151 | 151 | * @return int |
| 152 | 152 | */ |
| 153 | - public function getTotalTables () |
|
| 153 | + public function getTotalTables() |
|
| 154 | 154 | { |
| 155 | - if ( empty( $this->totalTables ) ) |
|
| 155 | + if (empty($this->totalTables)) |
|
| 156 | 156 | { |
| 157 | 157 | |
| 158 | - $this->totalTables = $this->getPDO ()->query ( |
|
| 158 | + $this->totalTables = $this->getPDO()->query( |
|
| 159 | 159 | "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = '{$this->database}'" |
| 160 | - )->fetchColumn (); |
|
| 160 | + )->fetchColumn(); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | return (int) $this->totalTables; |
@@ -171,13 +171,13 @@ discard block |
||
| 171 | 171 | * |
| 172 | 172 | * @return string |
| 173 | 173 | */ |
| 174 | - public function getSequence ( $table , $column ) |
|
| 174 | + public function getSequence($table, $column) |
|
| 175 | 175 | { |
| 176 | - $return = $this->getPDO () |
|
| 177 | - ->query ( "select * from information_schema.columns where extra like '%auto_increment%' and TABLE_SCHEMA='{$this->database}' AND TABLE_NAME='{$table}' AND COLUMN_NAME='{$column}';" ) |
|
| 178 | - ->fetch ( \PDO::FETCH_ASSOC ); |
|
| 176 | + $return = $this->getPDO() |
|
| 177 | + ->query("select * from information_schema.columns where extra like '%auto_increment%' and TABLE_SCHEMA='{$this->database}' AND TABLE_NAME='{$table}' AND COLUMN_NAME='{$column}';") |
|
| 178 | + ->fetch(\PDO::FETCH_ASSOC); |
|
| 179 | 179 | |
| 180 | - if ( ! $return ) |
|
| 180 | + if ( ! $return) |
|
| 181 | 181 | { |
| 182 | 182 | return; |
| 183 | 183 | } |
@@ -247,7 +247,7 @@ |
||
| 247 | 247 | { |
| 248 | 248 | $pdo = $this->getPDO (); |
| 249 | 249 | $return1 = $pdo->query ( "SELECT pg_get_serial_sequence('$table', '$column');" ) |
| 250 | - ->fetchColumn (); |
|
| 250 | + ->fetchColumn (); |
|
| 251 | 251 | |
| 252 | 252 | if ( $return1 ) |
| 253 | 253 | { |
@@ -71,7 +71,6 @@ |
||
| 71 | 71 | /** |
| 72 | 72 | * Retorna um Array com nome das tabelas |
| 73 | 73 | * |
| 74 | - * @param void $schema |
|
| 75 | 74 | * |
| 76 | 75 | * @return string[] |
| 77 | 76 | */ |
@@ -27,43 +27,43 @@ discard block |
||
| 27 | 27 | /** |
| 28 | 28 | * @type array|\string[] |
| 29 | 29 | */ |
| 30 | - protected $schema = array ( 'public' ); |
|
| 30 | + protected $schema = array('public'); |
|
| 31 | 31 | |
| 32 | - protected $dataTypes = array ( |
|
| 32 | + protected $dataTypes = array( |
|
| 33 | 33 | /* Numeric Types */ |
| 34 | - 'smallint' => 'int' , |
|
| 35 | - 'integer' => 'int' , |
|
| 36 | - 'bigint' => 'float' , |
|
| 37 | - 'decimal' => 'float' , |
|
| 38 | - 'numeric' => 'float' , |
|
| 39 | - 'real' => 'float' , |
|
| 40 | - 'double precision' => 'float' , |
|
| 41 | - 'serial' => 'int' , |
|
| 42 | - 'bigserial' => 'float' , |
|
| 34 | + 'smallint' => 'int', |
|
| 35 | + 'integer' => 'int', |
|
| 36 | + 'bigint' => 'float', |
|
| 37 | + 'decimal' => 'float', |
|
| 38 | + 'numeric' => 'float', |
|
| 39 | + 'real' => 'float', |
|
| 40 | + 'double precision' => 'float', |
|
| 41 | + 'serial' => 'int', |
|
| 42 | + 'bigserial' => 'float', |
|
| 43 | 43 | /* Monetary Types */ |
| 44 | - 'money' => 'float' , |
|
| 44 | + 'money' => 'float', |
|
| 45 | 45 | /* Character Types */ |
| 46 | - 'character varyin' => 'string' , |
|
| 47 | - 'varchar' => 'string' , |
|
| 48 | - 'character' => 'string' , |
|
| 49 | - 'char' => 'string' , |
|
| 50 | - 'text' => 'string' , |
|
| 46 | + 'character varyin' => 'string', |
|
| 47 | + 'varchar' => 'string', |
|
| 48 | + 'character' => 'string', |
|
| 49 | + 'char' => 'string', |
|
| 50 | + 'text' => 'string', |
|
| 51 | 51 | /* Binary Data Types */ |
| 52 | - 'bytea' => 'string' , |
|
| 52 | + 'bytea' => 'string', |
|
| 53 | 53 | /* Date/Time Types */ |
| 54 | - 'datatime' => 'date' , |
|
| 55 | - 'date' => 'date' , |
|
| 54 | + 'datatime' => 'date', |
|
| 55 | + 'date' => 'date', |
|
| 56 | 56 | |
| 57 | 57 | /* Boolean Type */ |
| 58 | 58 | 'boolean' => 'boolean' |
| 59 | 59 | ); |
| 60 | 60 | |
| 61 | - public function __construct ( AbstractAdapter $adapterConfig ) |
|
| 61 | + public function __construct(AbstractAdapter $adapterConfig) |
|
| 62 | 62 | { |
| 63 | - parent::__construct ( $adapterConfig ); |
|
| 64 | - if ( $adapterConfig->hasSchemas () ) |
|
| 63 | + parent::__construct($adapterConfig); |
|
| 64 | + if ($adapterConfig->hasSchemas()) |
|
| 65 | 65 | { |
| 66 | - $this->schema = $adapterConfig->getSchemas (); |
|
| 66 | + $this->schema = $adapterConfig->getSchemas(); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | } |
@@ -75,13 +75,13 @@ discard block |
||
| 75 | 75 | * |
| 76 | 76 | * @return string[] |
| 77 | 77 | */ |
| 78 | - public function getListNameTable () |
|
| 78 | + public function getListNameTable() |
|
| 79 | 79 | { |
| 80 | - if ( empty( $this->tableList ) ) |
|
| 80 | + if (empty($this->tableList)) |
|
| 81 | 81 | { |
| 82 | - $strSchema = implode ( "', '" , $this->schema ); |
|
| 82 | + $strSchema = implode("', '", $this->schema); |
|
| 83 | 83 | |
| 84 | - $this->tableList = $this->getPDO ()->query ( |
|
| 84 | + $this->tableList = $this->getPDO()->query( |
|
| 85 | 85 | "SELECT table_schema, |
| 86 | 86 | table_name |
| 87 | 87 | FROM information_schema.tables |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | table_schema, |
| 93 | 93 | table_name |
| 94 | 94 | ASC" |
| 95 | - )->fetchAll (); |
|
| 95 | + )->fetchAll(); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | return $this->tableList; |
@@ -103,11 +103,11 @@ discard block |
||
| 103 | 103 | * |
| 104 | 104 | * @return array |
| 105 | 105 | */ |
| 106 | - public function getListColumns () |
|
| 106 | + public function getListColumns() |
|
| 107 | 107 | { |
| 108 | - $strSchema = implode ( "', '" , $this->schema ); |
|
| 108 | + $strSchema = implode("', '", $this->schema); |
|
| 109 | 109 | |
| 110 | - return $this->getPDO ()->query ( |
|
| 110 | + return $this->getPDO()->query( |
|
| 111 | 111 | "SELECT distinct |
| 112 | 112 | c.table_schema, |
| 113 | 113 | c.table_name, |
@@ -121,14 +121,14 @@ discard block |
||
| 121 | 121 | ON st.table_name=c.table_name and st.table_type = 'BASE TABLE' |
| 122 | 122 | and c.table_schema IN ('$strSchema') |
| 123 | 123 | order by c.table_name asc" |
| 124 | - )->fetchAll ( \PDO::FETCH_ASSOC ); |
|
| 124 | + )->fetchAll(\PDO::FETCH_ASSOC); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - public function getListConstrant () |
|
| 127 | + public function getListConstrant() |
|
| 128 | 128 | { |
| 129 | - $strSchema = implode ( "', '" , $this->schema ); |
|
| 129 | + $strSchema = implode("', '", $this->schema); |
|
| 130 | 130 | |
| 131 | - return $this->getPDO ()->query ( |
|
| 131 | + return $this->getPDO()->query( |
|
| 132 | 132 | "SELECT distinct |
| 133 | 133 | tc.constraint_type, |
| 134 | 134 | tc.constraint_name, |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | ON tc.constraint_name = ccu.constraint_name |
| 149 | 149 | AND tc.constraint_schema = ccu.constraint_schema |
| 150 | 150 | ORDER by tc.table_schema" |
| 151 | - )->fetchAll ( \PDO::FETCH_ASSOC ); |
|
| 151 | + )->fetchAll(\PDO::FETCH_ASSOC); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | |
@@ -160,20 +160,20 @@ discard block |
||
| 160 | 160 | * |
| 161 | 161 | * @return string |
| 162 | 162 | */ |
| 163 | - public function getSequence ( $table , $column ) |
|
| 163 | + public function getSequence($table, $column) |
|
| 164 | 164 | { |
| 165 | - $pdo = $this->getPDO (); |
|
| 166 | - $return1 = $pdo->query ( "SELECT pg_get_serial_sequence('$table', '$column');" ) |
|
| 167 | - ->fetchColumn (); |
|
| 165 | + $pdo = $this->getPDO(); |
|
| 166 | + $return1 = $pdo->query("SELECT pg_get_serial_sequence('$table', '$column');") |
|
| 167 | + ->fetchColumn(); |
|
| 168 | 168 | |
| 169 | - if ( $return1 ) |
|
| 169 | + if ($return1) |
|
| 170 | 170 | { |
| 171 | 171 | return $return1; |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | - $dtbase = explode ( '.' , $table );; |
|
| 174 | + $dtbase = explode('.', $table); ; |
|
| 175 | 175 | |
| 176 | - $stmt = $pdo->prepare ( |
|
| 176 | + $stmt = $pdo->prepare( |
|
| 177 | 177 | "SELECT adsrc FROM pg_attrdef AS att |
| 178 | 178 | INNER JOIN pg_class AS c |
| 179 | 179 | ON adrelid = c.oid AND att.adnum=1 AND c.relname = ? |
@@ -181,19 +181,19 @@ discard block |
||
| 181 | 181 | ON n.oid = c.relnamespace and n.nspname=?" |
| 182 | 182 | ); |
| 183 | 183 | |
| 184 | - $schema = isset( $dtbase[ 1 ] ) ? $dtbase[ 1 ] : 'public'; |
|
| 184 | + $schema = isset($dtbase[1]) ? $dtbase[1] : 'public'; |
|
| 185 | 185 | |
| 186 | - $stmt->bindParam ( 1 , $schema ); |
|
| 187 | - $stmt->bindParam ( 2 , $dtbase[ 0 ] ); |
|
| 188 | - $stmt->execute (); |
|
| 189 | - $return2 = $stmt->fetchColumn (); |
|
| 190 | - if ( $return2 ) |
|
| 186 | + $stmt->bindParam(1, $schema); |
|
| 187 | + $stmt->bindParam(2, $dtbase[0]); |
|
| 188 | + $stmt->execute(); |
|
| 189 | + $return2 = $stmt->fetchColumn(); |
|
| 190 | + if ($return2) |
|
| 191 | 191 | { |
| 192 | - return preg_filter ( |
|
| 193 | - array ( |
|
| 194 | - '/nextval\(\'/' , |
|
| 192 | + return preg_filter( |
|
| 193 | + array( |
|
| 194 | + '/nextval\(\'/', |
|
| 195 | 195 | '/\'::regclass\)/' |
| 196 | - ) , '' , $return2 |
|
| 196 | + ), '', $return2 |
|
| 197 | 197 | ); |
| 198 | 198 | } |
| 199 | 199 | |
@@ -204,12 +204,12 @@ discard block |
||
| 204 | 204 | * @inheritDoc |
| 205 | 205 | * @return string |
| 206 | 206 | */ |
| 207 | - public function getPDOString () |
|
| 207 | + public function getPDOString() |
|
| 208 | 208 | { |
| 209 | - return sprintf ( |
|
| 210 | - "pgsql:host=%s;port=%s;dbname=%s" , |
|
| 211 | - $this->host , |
|
| 212 | - $this->port , |
|
| 209 | + return sprintf( |
|
| 210 | + "pgsql:host=%s;port=%s;dbname=%s", |
|
| 211 | + $this->host, |
|
| 212 | + $this->port, |
|
| 213 | 213 | $this->database |
| 214 | 214 | |
| 215 | 215 | ); |
@@ -219,11 +219,11 @@ discard block |
||
| 219 | 219 | * @inheritDoc |
| 220 | 220 | * @return string |
| 221 | 221 | */ |
| 222 | - public function getPDOSocketString () |
|
| 222 | + public function getPDOSocketString() |
|
| 223 | 223 | { |
| 224 | - return sprintf ( |
|
| 225 | - "pgsql:unix_socket=%s;dbname=%s" , |
|
| 226 | - $this->socket , |
|
| 224 | + return sprintf( |
|
| 225 | + "pgsql:unix_socket=%s;dbname=%s", |
|
| 226 | + $this->socket, |
|
| 227 | 227 | $this->database |
| 228 | 228 | |
| 229 | 229 | ); |
@@ -234,19 +234,19 @@ discard block |
||
| 234 | 234 | * |
| 235 | 235 | * @return int |
| 236 | 236 | */ |
| 237 | - public function getTotalTables () |
|
| 237 | + public function getTotalTables() |
|
| 238 | 238 | { |
| 239 | - if ( empty( $this->totalTables ) ) |
|
| 239 | + if (empty($this->totalTables)) |
|
| 240 | 240 | { |
| 241 | - $strSchema = implode ( "', '" , $this->schema ); |
|
| 241 | + $strSchema = implode("', '", $this->schema); |
|
| 242 | 242 | |
| 243 | - $this->totalTables = $this->getPDO ()->query ( |
|
| 243 | + $this->totalTables = $this->getPDO()->query( |
|
| 244 | 244 | "SELECT COUNT(table_name) AS total |
| 245 | 245 | FROM information_schema.tables |
| 246 | 246 | WHERE |
| 247 | 247 | table_type = 'BASE TABLE' |
| 248 | 248 | AND table_schema IN ( '" . $strSchema . "' )" |
| 249 | - )->fetchColumn (); |
|
| 249 | + )->fetchColumn(); |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | return (int) $this->totalTables; |
@@ -19,6 +19,6 @@ |
||
| 19 | 19 | |
| 20 | 20 | public function parseRelation ( \Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable ) |
| 21 | 21 | { |
| 22 | - return array(); |
|
| 22 | + return array(); |
|
| 23 | 23 | } |
| 24 | 24 | } |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | protected $parentFileTpl = ""; |
| 18 | 18 | protected $fileTpl = "model.php"; |
| 19 | 19 | |
| 20 | - public function parseRelation ( \Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable ) |
|
| 20 | + public function parseRelation(\Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable) |
|
| 21 | 21 | { |
| 22 | 22 | return array(); |
| 23 | 23 | } |
@@ -28,60 +28,60 @@ |
||
| 28 | 28 | * |
| 29 | 29 | * @return string[] |
| 30 | 30 | */ |
| 31 | - public function parseRelation ( \Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable ) |
|
| 31 | + public function parseRelation(\Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable) |
|
| 32 | 32 | { |
| 33 | 33 | $referenceMap = ''; |
| 34 | - $references = array (); |
|
| 34 | + $references = array(); |
|
| 35 | 35 | $dependentTables = ''; |
| 36 | - $dependents = array (); |
|
| 37 | - foreach ( $dbTable->getForeingkeys () as $fk ) |
|
| 36 | + $dependents = array(); |
|
| 37 | + foreach ($dbTable->getForeingkeys() as $fk) |
|
| 38 | 38 | { |
| 39 | - $constrant = $fk->getFks (); |
|
| 40 | - $references[] = sprintf ( |
|
| 39 | + $constrant = $fk->getFks(); |
|
| 40 | + $references[] = sprintf( |
|
| 41 | 41 | " |
| 42 | 42 | '%s' => array ( |
| 43 | 43 | 'columns' => '%s' , |
| 44 | 44 | 'refTableClass' => '%s', |
| 45 | 45 | 'refColumns' =>'%s' |
| 46 | 46 | )", |
| 47 | - AbstractMaker::getClassName ( $constrant->getNameConstrant () ), |
|
| 48 | - $fk->getName (), |
|
| 49 | - $makerFile->getConfig ()->createClassNamespace ( $constrant ) |
|
| 47 | + AbstractMaker::getClassName($constrant->getNameConstrant()), |
|
| 48 | + $fk->getName(), |
|
| 49 | + $makerFile->getConfig()->createClassNamespace($constrant) |
|
| 50 | 50 | . ZendFrameworkOne::SEPARETOR |
| 51 | 51 | . 'DbTable' |
| 52 | 52 | . ZendFrameworkOne::SEPARETOR |
| 53 | - . AbstractMaker::getClassName ( $constrant->getTable () ), |
|
| 54 | - $constrant->getColumn () |
|
| 53 | + . AbstractMaker::getClassName($constrant->getTable()), |
|
| 54 | + $constrant->getColumn() |
|
| 55 | 55 | |
| 56 | 56 | ); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - if ( sizeof ( $references ) > 0 ) |
|
| 59 | + if (sizeof($references) > 0) |
|
| 60 | 60 | { |
| 61 | 61 | $referenceMap = "protected \$_referenceMap = array(" . |
| 62 | - join ( ',', $references ) . "\n );"; |
|
| 62 | + join(',', $references) . "\n );"; |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - foreach ( $dbTable->getDependences () as $objColumn ) |
|
| 65 | + foreach ($dbTable->getDependences() as $objColumn) |
|
| 66 | 66 | { |
| 67 | - foreach ( $objColumn->getDependences () as $dependence ) |
|
| 67 | + foreach ($objColumn->getDependences() as $dependence) |
|
| 68 | 68 | { |
| 69 | - $dependents[] = $makerFile->getConfig ()->createClassNamespace ( $dependence ) |
|
| 69 | + $dependents[] = $makerFile->getConfig()->createClassNamespace($dependence) |
|
| 70 | 70 | . ZendFrameworkOne::SEPARETOR |
| 71 | 71 | . 'DbTable' |
| 72 | 72 | . ZendFrameworkOne::SEPARETOR |
| 73 | - . AbstractMaker::getClassName ( $dependence->getTable () ); |
|
| 73 | + . AbstractMaker::getClassName($dependence->getTable()); |
|
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - if ( sizeof ( $dependents ) > 0 ) |
|
| 77 | + if (sizeof($dependents) > 0) |
|
| 78 | 78 | { |
| 79 | 79 | $dependentTables = "protected \$_dependentTables = array(\n '" . |
| 80 | - join ( "',\n '", $dependents ) . "'\n );"; |
|
| 80 | + join("',\n '", $dependents) . "'\n );"; |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | |
| 84 | - return array ( |
|
| 84 | + return array( |
|
| 85 | 85 | 'referenceMap' => $referenceMap, |
| 86 | 86 | 'dependentTables' => $dependentTables |
| 87 | 87 | ); |
@@ -117,7 +117,7 @@ |
||
| 117 | 117 | */ |
| 118 | 118 | public function isOverwrite () |
| 119 | 119 | { |
| 120 | - return $this->overwrite; |
|
| 120 | + return $this->overwrite; |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | } |
@@ -11,29 +11,29 @@ discard block |
||
| 11 | 11 | /** |
| 12 | 12 | * @type AbstractAdapter[] |
| 13 | 13 | */ |
| 14 | - private static $_instance = array (); |
|
| 14 | + private static $_instance = array(); |
|
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * |
| 18 | 18 | */ |
| 19 | - final private function __construct () |
|
| 19 | + final private function __construct() |
|
| 20 | 20 | { |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | 24 | * @return \Classes\AdapterMakerFile\AbstractAdapter |
| 25 | 25 | */ |
| 26 | - public static function getInstance () |
|
| 26 | + public static function getInstance() |
|
| 27 | 27 | { |
| 28 | - $class = get_called_class (); |
|
| 29 | - $arr = explode ( '\\', $class ); |
|
| 30 | - $classEnd = end ( $arr ); |
|
| 31 | - if ( !isset( self::$_instance[ $classEnd ] ) ) |
|
| 28 | + $class = get_called_class(); |
|
| 29 | + $arr = explode('\\', $class); |
|
| 30 | + $classEnd = end($arr); |
|
| 31 | + if ( ! isset(self::$_instance[$classEnd])) |
|
| 32 | 32 | { |
| 33 | - self::$_instance[ $classEnd ] = new $class(); |
|
| 33 | + self::$_instance[$classEnd] = new $class(); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - return self::$_instance[ $classEnd ]; |
|
| 36 | + return self::$_instance[$classEnd]; |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * |
| 43 | 43 | * @return array |
| 44 | 44 | */ |
| 45 | - abstract public function parseRelation ( \Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable ); |
|
| 45 | + abstract public function parseRelation(\Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable); |
|
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * @type string |
@@ -74,15 +74,15 @@ discard block |
||
| 74 | 74 | * |
| 75 | 75 | * @return bool |
| 76 | 76 | */ |
| 77 | - public function hasDiretory () |
|
| 77 | + public function hasDiretory() |
|
| 78 | 78 | { |
| 79 | - return !empty( $this->pastName ); |
|
| 79 | + return ! empty($this->pastName); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
| 83 | 83 | * @return string |
| 84 | 84 | */ |
| 85 | - public function getParentClass () |
|
| 85 | + public function getParentClass() |
|
| 86 | 86 | { |
| 87 | 87 | return $this->parentClass; |
| 88 | 88 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | /** |
| 92 | 92 | * @return string |
| 93 | 93 | */ |
| 94 | - public function getFileTpl () |
|
| 94 | + public function getFileTpl() |
|
| 95 | 95 | { |
| 96 | 96 | return $this->fileTpl; |
| 97 | 97 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | /** |
| 100 | 100 | * @return string |
| 101 | 101 | */ |
| 102 | - public function getParentFileTpl () |
|
| 102 | + public function getParentFileTpl() |
|
| 103 | 103 | { |
| 104 | 104 | return $this->parentFileTpl; |
| 105 | 105 | } |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | /** |
| 108 | 108 | * @return string |
| 109 | 109 | */ |
| 110 | - public function getPastName () |
|
| 110 | + public function getPastName() |
|
| 111 | 111 | { |
| 112 | 112 | return $this->pastName; |
| 113 | 113 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | /** |
| 116 | 116 | * @return bool |
| 117 | 117 | */ |
| 118 | - public function isOverwrite () |
|
| 118 | + public function isOverwrite() |
|
| 119 | 119 | { |
| 120 | 120 | return $this->overwrite; |
| 121 | 121 | } |