@@ -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 | } |
@@ -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 | */ |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | { |
89 | 89 | foreach ( $arrFoldersName as $index => $folderName ) { |
90 | 90 | $arrFoldersName[ $index ] = $this->getConfig () |
91 | - ->replaceReservedWord ( $folderName ); |
|
91 | + ->replaceReservedWord ( $folderName ); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | return implode ( DIRECTORY_SEPARATOR, array_filter ( $arrFoldersName ) ); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $folderName, |
143 | 143 | $this->getClassName ( |
144 | 144 | $this->getConfig () |
145 | - ->getDatabase () |
|
145 | + ->getDatabase () |
|
146 | 146 | ) |
147 | 147 | ); |
148 | 148 | $this->location = array ( $this->filterLocation ( $url ) ); |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | * @return String |
276 | 276 | */ |
277 | 277 | protected function getParsedTplContents ( $tplFile, $vars = array (), \Classes\Db\DbTable $objTables = null, |
278 | - $objMakeFile = null |
|
278 | + $objMakeFile = null |
|
279 | 279 | ) { |
280 | 280 | |
281 | 281 | $arrUrl = array ( |
@@ -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 |
@@ -39,42 +39,42 @@ discard block |
||
39 | 39 | |
40 | 40 | private $msgReservedWord = "\033[0mPlease enter the value for reserved word \033[0;31m'%index%' \033[1;33m[%config%]:\033[0m "; |
41 | 41 | |
42 | - public function __construct ( Config $config ) |
|
42 | + public function __construct(Config $config) |
|
43 | 43 | { |
44 | - $this->config = $config->getAdapterConfig (); |
|
45 | - $this->parseReservedWord ( $this->getConfig () ); |
|
46 | - $this->driver = $config->getAdapterDriver ( $this->getConfig () ); |
|
47 | - $this->parseLocation ( $config->_basePath ); |
|
44 | + $this->config = $config->getAdapterConfig(); |
|
45 | + $this->parseReservedWord($this->getConfig()); |
|
46 | + $this->driver = $config->getAdapterDriver($this->getConfig()); |
|
47 | + $this->parseLocation($config->_basePath); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
51 | 51 | * @param AdapterConfig\AbstractAdapter $config |
52 | 52 | */ |
53 | - public function parseReservedWord ( AdapterConfig\AbstractAdapter $config ) |
|
53 | + public function parseReservedWord(AdapterConfig\AbstractAdapter $config) |
|
54 | 54 | { |
55 | 55 | $palavrasReservadas = $config->reservedWord; |
56 | - if ( !$palavrasReservadas ) { |
|
56 | + if ( ! $palavrasReservadas) { |
|
57 | 57 | return; |
58 | 58 | } |
59 | 59 | |
60 | - $schema = $config->getSchemas (); |
|
61 | - $db = $config->getDatabase (); |
|
62 | - $hasSchema = array_intersect ( $schema, array_flip ( $palavrasReservadas ) ); |
|
63 | - $hasDatabase = in_array ( $db, $palavrasReservadas ); |
|
64 | - if ( !( $hasSchema or $hasDatabase ) ) { |
|
60 | + $schema = $config->getSchemas(); |
|
61 | + $db = $config->getDatabase(); |
|
62 | + $hasSchema = array_intersect($schema, array_flip($palavrasReservadas)); |
|
63 | + $hasDatabase = in_array($db, $palavrasReservadas); |
|
64 | + if ( ! ($hasSchema or $hasDatabase)) { |
|
65 | 65 | return; |
66 | 66 | } |
67 | 67 | |
68 | 68 | echo "- database has reserved words\n"; |
69 | - foreach ( $palavrasReservadas as $index => $config ) { |
|
70 | - $attribs = array ( |
|
69 | + foreach ($palavrasReservadas as $index => $config) { |
|
70 | + $attribs = array( |
|
71 | 71 | "%index%" => $index, |
72 | 72 | "%config%" => $config |
73 | 73 | ); |
74 | - echo strtr ( $this->msgReservedWord, $attribs ); |
|
75 | - $line = trim ( fgets ( STDIN ) ); |
|
76 | - if ( !empty( $line ) ) { |
|
77 | - $this->getConfig()->reservedWord[ $index ] = $line; |
|
74 | + echo strtr($this->msgReservedWord, $attribs); |
|
75 | + $line = trim(fgets(STDIN)); |
|
76 | + if ( ! empty($line)) { |
|
77 | + $this->getConfig()->reservedWord[$index] = $line; |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | } |
@@ -84,156 +84,156 @@ discard block |
||
84 | 84 | * |
85 | 85 | * @return string |
86 | 86 | */ |
87 | - private function filterLocation ( $arrFoldersName ) |
|
87 | + private function filterLocation($arrFoldersName) |
|
88 | 88 | { |
89 | - foreach ( $arrFoldersName as $index => $folderName ) { |
|
90 | - $arrFoldersName[ $index ] = $this->getConfig () |
|
91 | - ->replaceReservedWord ( $folderName ); |
|
89 | + foreach ($arrFoldersName as $index => $folderName) { |
|
90 | + $arrFoldersName[$index] = $this->getConfig() |
|
91 | + ->replaceReservedWord($folderName); |
|
92 | 92 | } |
93 | 93 | |
94 | - return implode ( DIRECTORY_SEPARATOR, array_filter ( $arrFoldersName ) ); |
|
94 | + return implode(DIRECTORY_SEPARATOR, array_filter($arrFoldersName)); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
98 | 98 | * Analisa os caminhos das pastas base |
99 | 99 | */ |
100 | - public function parseLocation ( $basePath ) |
|
100 | + public function parseLocation($basePath) |
|
101 | 101 | { |
102 | 102 | |
103 | - $arrBase = array ( |
|
103 | + $arrBase = array( |
|
104 | 104 | $basePath, |
105 | 105 | $this->config->path |
106 | 106 | ); |
107 | 107 | |
108 | - $this->baseLocation = $this->filterLocation ( $arrBase ); |
|
108 | + $this->baseLocation = $this->filterLocation($arrBase); |
|
109 | 109 | |
110 | 110 | # pasta com nome do driver do banco |
111 | 111 | $driverBase = ''; |
112 | - if ( (bool) @$this->config->{"folder-database"} ) { |
|
113 | - $classDriver = explode ( '\\', get_class ( $this->driver ) ); |
|
114 | - $driverBase = end ( $classDriver ); |
|
112 | + if ((bool) @$this->config->{"folder-database"} ) { |
|
113 | + $classDriver = explode('\\', get_class($this->driver)); |
|
114 | + $driverBase = end($classDriver); |
|
115 | 115 | } |
116 | 116 | $folderName = ''; |
117 | - if ( (bool) @$this->config->{"folder-name"} ) { |
|
118 | - $folderName = $this->getClassName ( trim ( $this->config->{"folder-name"} ) ); |
|
117 | + if ((bool) @$this->config->{"folder-name"} ) { |
|
118 | + $folderName = $this->getClassName(trim($this->config->{"folder-name"} )); |
|
119 | 119 | } |
120 | 120 | |
121 | - if ( $this->config->hasSchemas () ) { |
|
121 | + if ($this->config->hasSchemas()) { |
|
122 | 122 | |
123 | - $schemas = $this->config->getSchemas (); |
|
124 | - foreach ( $schemas as $schema ) { |
|
125 | - $arrUrl = array ( |
|
123 | + $schemas = $this->config->getSchemas(); |
|
124 | + foreach ($schemas as $schema) { |
|
125 | + $arrUrl = array( |
|
126 | 126 | $this->baseLocation, |
127 | 127 | $driverBase, |
128 | 128 | $folderName, |
129 | - $this->getClassName ( $schema ) |
|
129 | + $this->getClassName($schema) |
|
130 | 130 | ); |
131 | 131 | |
132 | - $this->location[ $schema ] = $this->filterLocation ( $arrUrl ); |
|
133 | - unset( $arrUrl ); |
|
132 | + $this->location[$schema] = $this->filterLocation($arrUrl); |
|
133 | + unset($arrUrl); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | |
137 | 137 | } |
138 | 138 | else { |
139 | - $url = array ( |
|
139 | + $url = array( |
|
140 | 140 | $this->baseLocation, |
141 | 141 | $driverBase, |
142 | 142 | $folderName, |
143 | - $this->getClassName ( |
|
144 | - $this->getConfig () |
|
145 | - ->getDatabase () |
|
143 | + $this->getClassName( |
|
144 | + $this->getConfig() |
|
145 | + ->getDatabase() |
|
146 | 146 | ) |
147 | 147 | ); |
148 | - $this->location = array ( $this->filterLocation ( $url ) ); |
|
149 | - unset( $url ); |
|
148 | + $this->location = array($this->filterLocation($url)); |
|
149 | + unset($url); |
|
150 | 150 | } |
151 | 151 | } |
152 | 152 | |
153 | 153 | /** |
154 | 154 | * @return AdapterConfig\AbstractAdapter |
155 | 155 | */ |
156 | - public function getConfig () |
|
156 | + public function getConfig() |
|
157 | 157 | { |
158 | 158 | return $this->config; |
159 | 159 | } |
160 | 160 | |
161 | 161 | /* Get current time */ |
162 | - public function startTime () |
|
162 | + public function startTime() |
|
163 | 163 | { |
164 | 164 | echo "Starting..\n"; |
165 | - $this->startTime = microtime ( true ); |
|
165 | + $this->startTime = microtime(true); |
|
166 | 166 | } |
167 | 167 | |
168 | - private function getRunTime () |
|
168 | + private function getRunTime() |
|
169 | 169 | { |
170 | - return round ( ( microtime ( true ) - $this->startTime ), 3 ); |
|
170 | + return round((microtime(true) - $this->startTime), 3); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
174 | 174 | * Executa o Make, criando arquivos e Diretorios |
175 | 175 | */ |
176 | - public function run () |
|
176 | + public function run() |
|
177 | 177 | { |
178 | - $this->startTime (); |
|
179 | - $this->driver->runDatabase (); |
|
180 | - $countSchema = count ( $this->location ); |
|
181 | - $max = $this->driver->getTotalTables () * ( $countSchema * $this->countDiretory () ); |
|
178 | + $this->startTime(); |
|
179 | + $this->driver->runDatabase(); |
|
180 | + $countSchema = count($this->location); |
|
181 | + $max = $this->driver->getTotalTables() * ($countSchema * $this->countDiretory()); |
|
182 | 182 | $cur = 0; |
183 | 183 | |
184 | 184 | |
185 | - foreach ( $this->location as $schema => $location ) { |
|
186 | - foreach ( $this->factoryMakerFile () as $objMakeFile ) { |
|
187 | - $path = $location . DIRECTORY_SEPARATOR . $objMakeFile->getPastName (); |
|
188 | - self::makeDir ( $path ); |
|
185 | + foreach ($this->location as $schema => $location) { |
|
186 | + foreach ($this->factoryMakerFile() as $objMakeFile) { |
|
187 | + $path = $location . DIRECTORY_SEPARATOR . $objMakeFile->getPastName(); |
|
188 | + self::makeDir($path); |
|
189 | 189 | |
190 | - if ( $objMakeFile->getParentFileTpl () != '' ) { |
|
190 | + if ($objMakeFile->getParentFileTpl() != '') { |
|
191 | 191 | $fileAbstract = $this->baseLocation |
192 | 192 | . DIRECTORY_SEPARATOR |
193 | - . $objMakeFile->getParentClass () |
|
193 | + . $objMakeFile->getParentClass() |
|
194 | 194 | . '.php'; |
195 | 195 | |
196 | - $tplAbstract = $this->getParsedTplContents ( $objMakeFile->getParentFileTpl () ); |
|
197 | - self::makeSourcer ( $fileAbstract, $tplAbstract, $objMakeFile->isOverwrite () ); |
|
198 | - unset( $fileAbstract, $tplAbstract ); |
|
196 | + $tplAbstract = $this->getParsedTplContents($objMakeFile->getParentFileTpl()); |
|
197 | + self::makeSourcer($fileAbstract, $tplAbstract, $objMakeFile->isOverwrite()); |
|
198 | + unset($fileAbstract, $tplAbstract); |
|
199 | 199 | } |
200 | 200 | |
201 | - foreach ( $this->driver->getTables ( $schema ) as $key => $objTables ) { |
|
202 | - $total = ceil ( $cur / $max ) * 100; |
|
203 | - printf ( "\r Creating: %6.2f%%", $total ); |
|
201 | + foreach ($this->driver->getTables($schema) as $key => $objTables) { |
|
202 | + $total = ceil($cur / $max) * 100; |
|
203 | + printf("\r Creating: %6.2f%%", $total); |
|
204 | 204 | $cur++; |
205 | 205 | |
206 | - $file = $path . DIRECTORY_SEPARATOR . self::getClassName ( $objTables->getName () ) . '.php'; |
|
206 | + $file = $path . DIRECTORY_SEPARATOR . self::getClassName($objTables->getName()) . '.php'; |
|
207 | 207 | |
208 | 208 | |
209 | - $tpl = $this->getParsedTplContents ( |
|
210 | - $objMakeFile->getFileTpl (), |
|
211 | - $objMakeFile->parseRelation ( $this, $objTables ), |
|
209 | + $tpl = $this->getParsedTplContents( |
|
210 | + $objMakeFile->getFileTpl(), |
|
211 | + $objMakeFile->parseRelation($this, $objTables), |
|
212 | 212 | $objTables, |
213 | 213 | $objMakeFile |
214 | 214 | |
215 | 215 | ); |
216 | - self::makeSourcer ( $file, $tpl, $objMakeFile->isOverwrite () ); |
|
216 | + self::makeSourcer($file, $tpl, $objMakeFile->isOverwrite()); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | } |
220 | 220 | } |
221 | 221 | |
222 | - $this->reportProcess ( $cur ); |
|
222 | + $this->reportProcess($cur); |
|
223 | 223 | echo "\n\033[1;32mSuccessfully process finished!\n\033[0m"; |
224 | 224 | } |
225 | 225 | |
226 | - private function reportProcess ( $countFiles ) |
|
226 | + private function reportProcess($countFiles) |
|
227 | 227 | { |
228 | - if ( $this->config->isStatusEnabled () ) { |
|
229 | - $databases = count ( $this->location ); |
|
230 | - $countDir = $this->countDiretory (); |
|
231 | - $totalTable = $this->driver->getTotalTables (); |
|
228 | + if ($this->config->isStatusEnabled()) { |
|
229 | + $databases = count($this->location); |
|
230 | + $countDir = $this->countDiretory(); |
|
231 | + $totalTable = $this->driver->getTotalTables(); |
|
232 | 232 | echo "\n------"; |
233 | - printf ( "\n\r-Files generated:%s", $countFiles ); |
|
234 | - printf ( "\n\r-Diretory generated:%s", $databases * $countDir ); |
|
235 | - printf ( "\n\r-Scanned tables:%s", $totalTable ); |
|
236 | - printf ( "\n\r-Execution time: %ssec", $this->getRunTime () ); |
|
233 | + printf("\n\r-Files generated:%s", $countFiles); |
|
234 | + printf("\n\r-Diretory generated:%s", $databases * $countDir); |
|
235 | + printf("\n\r-Scanned tables:%s", $totalTable); |
|
236 | + printf("\n\r-Execution time: %ssec", $this->getRunTime()); |
|
237 | 237 | echo "\n------"; |
238 | 238 | } |
239 | 239 | } |
@@ -243,9 +243,9 @@ discard block |
||
243 | 243 | * |
244 | 244 | * @return AbstractAdapter[] |
245 | 245 | */ |
246 | - public function factoryMakerFile () |
|
246 | + public function factoryMakerFile() |
|
247 | 247 | { |
248 | - return $this->config->getMakeFileInstances (); |
|
248 | + return $this->config->getMakeFileInstances(); |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | /** |
@@ -253,11 +253,11 @@ discard block |
||
253 | 253 | * |
254 | 254 | * @return int |
255 | 255 | */ |
256 | - public function countDiretory () |
|
256 | + public function countDiretory() |
|
257 | 257 | { |
258 | 258 | $dir = 0; |
259 | - foreach ( $this->factoryMakerFile () as $abstractAdapter ) { |
|
260 | - if ( $abstractAdapter->hasDiretory () ) { |
|
259 | + foreach ($this->factoryMakerFile() as $abstractAdapter) { |
|
260 | + if ($abstractAdapter->hasDiretory()) { |
|
261 | 261 | $dir++; |
262 | 262 | } |
263 | 263 | } |
@@ -274,24 +274,24 @@ discard block |
||
274 | 274 | * |
275 | 275 | * @return String |
276 | 276 | */ |
277 | - protected function getParsedTplContents ( $tplFile, $vars = array (), \Classes\Db\DbTable $objTables = null, |
|
277 | + protected function getParsedTplContents($tplFile, $vars = array(), \Classes\Db\DbTable $objTables = null, |
|
278 | 278 | $objMakeFile = null |
279 | 279 | ) { |
280 | 280 | |
281 | - $arrUrl = array ( |
|
281 | + $arrUrl = array( |
|
282 | 282 | __DIR__, |
283 | 283 | 'templates', |
284 | 284 | $this->config->framework, |
285 | 285 | $tplFile |
286 | 286 | ); |
287 | 287 | |
288 | - $filePath = implode ( DIRECTORY_SEPARATOR, filter_var_array ( $arrUrl ) ); |
|
288 | + $filePath = implode(DIRECTORY_SEPARATOR, filter_var_array($arrUrl)); |
|
289 | 289 | |
290 | - extract ( $vars ); |
|
291 | - ob_start (); |
|
290 | + extract($vars); |
|
291 | + ob_start(); |
|
292 | 292 | require $filePath; |
293 | - $data = ob_get_contents (); |
|
294 | - ob_end_clean (); |
|
293 | + $data = ob_get_contents(); |
|
294 | + ob_end_clean(); |
|
295 | 295 | |
296 | 296 | return $data; |
297 | 297 | } |
@@ -134,8 +134,7 @@ |
||
134 | 134 | } |
135 | 135 | |
136 | 136 | |
137 | - } |
|
138 | - else { |
|
137 | + } else { |
|
139 | 138 | $url = array ( |
140 | 139 | $this->baseLocation, |
141 | 140 | $driverBase, |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | |
23 | 23 | const SEPARETOR = "_"; |
24 | 24 | |
25 | - protected function init () |
|
25 | + protected function init() |
|
26 | 26 | { |
27 | 27 | } |
28 | 28 | |
@@ -31,50 +31,50 @@ discard block |
||
31 | 31 | * |
32 | 32 | * @return array |
33 | 33 | */ |
34 | - protected function getParams () |
|
34 | + protected function getParams() |
|
35 | 35 | { |
36 | - if ( ! $this->config or ! $this->isValidFrameworkFiles () ) |
|
36 | + if ( ! $this->config or ! $this->isValidFrameworkFiles()) |
|
37 | 37 | { |
38 | - return array (); |
|
38 | + return array(); |
|
39 | 39 | } |
40 | 40 | |
41 | - return array ( |
|
41 | + return array( |
|
42 | 42 | //Driver do banco de dados |
43 | - 'driver' => $this->config[ 'adapter' ] , |
|
43 | + 'driver' => $this->config['adapter'], |
|
44 | 44 | //Nome do banco de dados |
45 | - 'database' => $this->config[ 'params' ][ 'dbname' ] , |
|
45 | + 'database' => $this->config['params']['dbname'], |
|
46 | 46 | //Host do banco |
47 | - 'host' => $this->config[ 'params' ][ 'host' ] , |
|
47 | + 'host' => $this->config['params']['host'], |
|
48 | 48 | //Port do banco |
49 | - 'port' => isset( $this->config[ 'params' ][ 'port' ] ) |
|
50 | - ? $this->config[ 'params' ][ 'port' ] : '' , |
|
49 | + 'port' => isset($this->config['params']['port']) |
|
50 | + ? $this->config['params']['port'] : '', |
|
51 | 51 | //usuario do banco |
52 | - 'username' => $this->config[ 'params' ][ 'username' ] , |
|
52 | + 'username' => $this->config['params']['username'], |
|
53 | 53 | //senha do banco |
54 | - 'password' => $this->config[ 'params' ][ 'password' ] , |
|
54 | + 'password' => $this->config['params']['password'], |
|
55 | 55 | ); |
56 | 56 | } |
57 | 57 | |
58 | - protected function parseFrameworkConfig () |
|
58 | + protected function parseFrameworkConfig() |
|
59 | 59 | { |
60 | - if ( ! $this->isValidFrameworkFiles () ) |
|
60 | + if ( ! $this->isValidFrameworkFiles()) |
|
61 | 61 | { |
62 | 62 | return; |
63 | 63 | } |
64 | 64 | |
65 | - $frameworkIni = $this->getFrameworkIni (); |
|
65 | + $frameworkIni = $this->getFrameworkIni(); |
|
66 | 66 | |
67 | 67 | require_once 'Zend/Config/Ini.php'; |
68 | 68 | |
69 | 69 | $objConfig = new \Zend_Config_Ini( |
70 | - realpath ( $frameworkIni ) , $this->getEnvironment () |
|
70 | + realpath($frameworkIni), $this->getEnvironment() |
|
71 | 71 | ); |
72 | 72 | |
73 | - $arrConfig = $objConfig->toArray (); |
|
73 | + $arrConfig = $objConfig->toArray(); |
|
74 | 74 | |
75 | - if ( isset( $arrConfig[ 'resources' ][ 'db' ] ) ) |
|
75 | + if (isset($arrConfig['resources']['db'])) |
|
76 | 76 | { |
77 | - $this->config = $arrConfig[ 'resources' ][ 'db' ]; |
|
77 | + $this->config = $arrConfig['resources']['db']; |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
@@ -83,12 +83,12 @@ discard block |
||
83 | 83 | * |
84 | 84 | * @return \Classes\AdapterMakerFile\AbstractAdapter[] |
85 | 85 | */ |
86 | - public function getMakeFileInstances () |
|
86 | + public function getMakeFileInstances() |
|
87 | 87 | { |
88 | - return array ( |
|
89 | - DbTable::getInstance () , |
|
90 | - Entity::getInstance () , |
|
91 | - Model::getInstance () |
|
88 | + return array( |
|
89 | + DbTable::getInstance(), |
|
90 | + Entity::getInstance(), |
|
91 | + Model::getInstance() |
|
92 | 92 | ); |
93 | 93 | } |
94 | 94 |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | |
23 | 23 | const SEPARETOR = "_"; |
24 | 24 | |
25 | - protected function init () |
|
25 | + protected function init() |
|
26 | 26 | { |
27 | 27 | } |
28 | 28 | |
@@ -31,12 +31,12 @@ discard block |
||
31 | 31 | * |
32 | 32 | * @return array |
33 | 33 | */ |
34 | - protected function getParams () |
|
34 | + protected function getParams() |
|
35 | 35 | { |
36 | 36 | |
37 | 37 | } |
38 | 38 | |
39 | - protected function parseFrameworkConfig () |
|
39 | + protected function parseFrameworkConfig() |
|
40 | 40 | { |
41 | 41 | // TODO: Implement parseFrameworkConfig() method. |
42 | 42 | } |
@@ -46,12 +46,12 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @return \Classes\AdapterMakerFile\AbstractAdapter[] |
48 | 48 | */ |
49 | - public function getMakeFileInstances () |
|
49 | + public function getMakeFileInstances() |
|
50 | 50 | { |
51 | - return array ( |
|
52 | - DbTable::getInstance (), |
|
53 | - Entity::getInstance (), |
|
54 | - Model::getInstance () |
|
51 | + return array( |
|
52 | + DbTable::getInstance(), |
|
53 | + Entity::getInstance(), |
|
54 | + Model::getInstance() |
|
55 | 55 | ); |
56 | 56 | } |
57 | 57 |
@@ -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 | } |
@@ -12,9 +12,9 @@ |
||
12 | 12 | /** |
13 | 13 | * @var void |
14 | 14 | */ |
15 | - protected $fileTpl = "model.php"; |
|
15 | + protected $fileTpl = "model.php"; |
|
16 | 16 | |
17 | - public function parseRelation ( \Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable ) |
|
17 | + public function parseRelation(\Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable) |
|
18 | 18 | { |
19 | 19 | return array(); |
20 | 20 | } |
@@ -172,6 +172,7 @@ |
||
172 | 172 | * @param $constraint_name |
173 | 173 | * @param $table_name |
174 | 174 | * @param $column_name |
175 | + * @param string $database |
|
175 | 176 | * |
176 | 177 | * @return $this |
177 | 178 | */ |
@@ -178,15 +178,15 @@ |
||
178 | 178 | public function createDependece ( $constraint_name , $table_name , $column_name ,$database, $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 | - 'database' => $database |
|
188 | - ) |
|
189 | - ); |
|
181 | + ->populate ( |
|
182 | + array ( |
|
183 | + 'constrant' => $constraint_name , |
|
184 | + 'schema' => $schema , |
|
185 | + 'table' => $table_name , |
|
186 | + 'column' => $column_name, |
|
187 | + 'database' => $database |
|
188 | + ) |
|
189 | + ); |
|
190 | 190 | |
191 | 191 | $this->addDependece ( $objConstrantDependence ); |
192 | 192 |
@@ -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,20 +175,20 @@ discard block |
||
175 | 175 | * |
176 | 176 | * @return $this |
177 | 177 | */ |
178 | - public function createDependece ( $constraint_name , $table_name , $column_name ,$database, $schema = null ) |
|
178 | + public function createDependece($constraint_name, $table_name, $column_name, $database, $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 | 'database' => $database |
188 | 188 | ) |
189 | 189 | ); |
190 | 190 | |
191 | - $this->addDependece ( $objConstrantDependence ); |
|
191 | + $this->addDependece($objConstrantDependence); |
|
192 | 192 | |
193 | 193 | return $this; |
194 | 194 | } |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | /** |
197 | 197 | * @param \Classes\Db\Constrant $reference |
198 | 198 | */ |
199 | - public function addRefFk ( Constrant $reference ) |
|
199 | + public function addRefFk(Constrant $reference) |
|
200 | 200 | { |
201 | 201 | $this->refForeingkey = $reference; |
202 | 202 | |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | * |
209 | 209 | * @return \Classes\Db\Constrant |
210 | 210 | */ |
211 | - public function getFks () |
|
211 | + public function getFks() |
|
212 | 212 | { |
213 | 213 | return $this->refForeingkey; |
214 | 214 | } |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | * |
219 | 219 | * @return \Classes\Db\Constrant[] |
220 | 220 | */ |
221 | - public function getDependences () |
|
221 | + public function getDependences() |
|
222 | 222 | { |
223 | 223 | return $this->dependences; |
224 | 224 | } |
@@ -226,9 +226,9 @@ discard block |
||
226 | 226 | /** |
227 | 227 | * @return bool |
228 | 228 | */ |
229 | - public function hasDependences () |
|
229 | + public function hasDependences() |
|
230 | 230 | { |
231 | - return (bool) count ( $this->dependences ); |
|
231 | + return (bool) count($this->dependences); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | /** |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | * |
237 | 237 | * @return \Classes\Db\Constrant[] |
238 | 238 | */ |
239 | - public function getPrimaryKey () |
|
239 | + public function getPrimaryKey() |
|
240 | 240 | { |
241 | 241 | return $this->primarykey; |
242 | 242 | } |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | /** |
245 | 245 | * |
246 | 246 | */ |
247 | - public function getMaxLength () |
|
247 | + public function getMaxLength() |
|
248 | 248 | { |
249 | 249 | return $this->max_length; |
250 | 250 | } |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | /** |
253 | 253 | * @return bool |
254 | 254 | */ |
255 | - public function hasSequence () |
|
255 | + public function hasSequence() |
|
256 | 256 | { |
257 | 257 | return (bool) $this->sequence; |
258 | 258 | } |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | /** |
261 | 261 | * @return string |
262 | 262 | */ |
263 | - public function getSequence () |
|
263 | + public function getSequence() |
|
264 | 264 | { |
265 | 265 | return $this->sequence; |
266 | 266 | } |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | /** |
269 | 269 | * @param string $sequence |
270 | 270 | */ |
271 | - public function setSequence ( $sequence ) |
|
271 | + public function setSequence($sequence) |
|
272 | 272 | { |
273 | 273 | $this->sequence = $sequence; |
274 | 274 | } |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | /** |
277 | 277 | * @return boolean |
278 | 278 | */ |
279 | - public function isNullable () |
|
279 | + public function isNullable() |
|
280 | 280 | { |
281 | 281 | return $this->nullable; |
282 | 282 | } |
@@ -70,6 +70,9 @@ |
||
70 | 70 | return $this; |
71 | 71 | } |
72 | 72 | |
73 | + /** |
|
74 | + * @return string |
|
75 | + */ |
|
73 | 76 | public function getDatabase (){ |
74 | 77 | return $this->database; |
75 | 78 | } |
@@ -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,34 +55,34 @@ 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->database = $array[ 'database' ]; |
|
66 | - $this->constrant = $array[ 'constrant' ]; |
|
67 | - $this->table = $array[ 'table' ]; |
|
68 | - $this->column = $array[ 'column' ]; |
|
65 | + $this->database = $array['database']; |
|
66 | + $this->constrant = $array['constrant']; |
|
67 | + $this->table = $array['table']; |
|
68 | + $this->column = $array['column']; |
|
69 | 69 | |
70 | 70 | return $this; |
71 | 71 | } |
72 | 72 | |
73 | - public function getDatabase (){ |
|
73 | + public function getDatabase() { |
|
74 | 74 | return $this->database; |
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
78 | 78 | * @return string |
79 | 79 | */ |
80 | - public function getNameConstrant () |
|
80 | + public function getNameConstrant() |
|
81 | 81 | { |
82 | 82 | return $this->constrant; |
83 | 83 | } |
84 | 84 | |
85 | - public function hasSchema () |
|
85 | + public function hasSchema() |
|
86 | 86 | { |
87 | 87 | return (bool) $this->schema; |
88 | 88 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | /** |
91 | 91 | * @return string |
92 | 92 | */ |
93 | - public function getSchema () |
|
93 | + public function getSchema() |
|
94 | 94 | { |
95 | 95 | return $this->schema; |
96 | 96 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | /** |
99 | 99 | * @return string |
100 | 100 | */ |
101 | - public function getTable () |
|
101 | + public function getTable() |
|
102 | 102 | { |
103 | 103 | return $this->table; |
104 | 104 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | /** |
107 | 107 | * @return string |
108 | 108 | */ |
109 | - public function getColumn () |
|
109 | + public function getColumn() |
|
110 | 110 | { |
111 | 111 | return $this->column; |
112 | 112 | } |