@@ -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 |
@@ -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 | } |
@@ -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 | } |
@@ -16,9 +16,9 @@ |
||
16 | 16 | { |
17 | 17 | private $msg = "As configuracoes a seguir sao obrigatorias: \033[0;31m%value%\033[0m"; |
18 | 18 | |
19 | - public function __construct ( $array , $code = 0 ) |
|
19 | + public function __construct($array, $code = 0) |
|
20 | 20 | { |
21 | - $attribs = implode ( ', ' , array_keys ( $array ) ); |
|
22 | - parent::__construct ( str_replace ( "%value%" , $attribs , $this->msg ) , (int) $code ); |
|
21 | + $attribs = implode(', ', array_keys($array)); |
|
22 | + parent::__construct(str_replace("%value%", $attribs, $this->msg), (int) $code); |
|
23 | 23 | } |
24 | 24 | } |
25 | 25 | \ No newline at end of file |
@@ -1,19 +1,19 @@ discard block |
||
1 | 1 | <?="<?php\n"?> |
2 | -<?php $className = $objTables->getNamespace(). '_Entity_' . \Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () )?> |
|
2 | +<?php $className = $objTables->getNamespace() . '_Entity_' . \Classes\Maker\AbstractMaker::getClassName($objTables->getName())?> |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Application Entity |
6 | 6 | * |
7 | - * <?=$this->config->last_modify."\n"?> |
|
7 | + * <?=$this->config->last_modify . "\n"?> |
|
8 | 8 | * |
9 | - * @package <?=$objTables->getNamespace()."\n"?> |
|
9 | + * @package <?=$objTables->getNamespace() . "\n"?> |
|
10 | 10 | * @subpackage Entity |
11 | 11 | * |
12 | - * @author <?=$this->config->author."\n"?> |
|
12 | + * @author <?=$this->config->author . "\n"?> |
|
13 | 13 | * |
14 | - * @copyright <?=$this->config->copyright."\n"?> |
|
15 | - * @license <?=$this->config->license."\n"?> |
|
16 | - * @link <?=$this->config->link."\n"?> |
|
14 | + * @copyright <?=$this->config->copyright . "\n"?> |
|
15 | + * @license <?=$this->config->license . "\n"?> |
|
16 | + * @link <?=$this->config->link . "\n"?> |
|
17 | 17 | */ |
18 | 18 | |
19 | 19 | /** |
@@ -25,11 +25,11 @@ discard block |
||
25 | 25 | |
26 | 26 | <?php foreach ($objTables->getColumns() as $column): ?> |
27 | 27 | /** |
28 | - * Database constraint in the column <?=$column->getName()."\n"?> |
|
28 | + * Database constraint in the column <?=$column->getName() . "\n"?> |
|
29 | 29 | * |
30 | 30 | */ |
31 | 31 | const <?=strtoupper($column->getName())?> = '<?=$objTables->getName()?>.<?=$column->getName()?>'; |
32 | -<?php endforeach;?> |
|
32 | +<?php endforeach; ?> |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Nome da tabela DbTable do model |
@@ -37,16 +37,16 @@ discard block |
||
37 | 37 | * @var string |
38 | 38 | * @access protected |
39 | 39 | */ |
40 | - protected $_tableClass = '<?=$objTables->getNamespace()?>_DbTable_<?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () )?>'; |
|
40 | + protected $_tableClass = '<?=$objTables->getNamespace()?>_DbTable_<?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName())?>'; |
|
41 | 41 | |
42 | 42 | /** |
43 | 43 | * @see <?=$this->config->namespace?>Model_EntityAbstract::$_filters |
44 | 44 | */ |
45 | 45 | protected $_filters = array( |
46 | -<?php foreach ( $objTables->getColumns () as $column ): ?> |
|
46 | +<?php foreach ($objTables->getColumns() as $column): ?> |
|
47 | 47 | <?php |
48 | 48 | $filters = null; |
49 | - switch ( ucfirst ( $column->getType () ) ) |
|
49 | + switch (ucfirst($column->getType())) |
|
50 | 50 | { |
51 | 51 | case 'String': |
52 | 52 | $filters = 'StripTags", "StringTrim'; |
@@ -55,50 +55,50 @@ discard block |
||
55 | 55 | $filters = 'Digits'; |
56 | 56 | break; |
57 | 57 | default: |
58 | - $filters = ucfirst ( $column->getType () ); |
|
58 | + $filters = ucfirst($column->getType()); |
|
59 | 59 | break; |
60 | 60 | } |
61 | 61 | ?> |
62 | 62 | '<?=$column->getName()?>'=>array ( |
63 | - <?=( !empty( $filters ) ) ? "\"{$filters}\"\n" : null; ?> |
|
63 | + <?=( ! empty($filters)) ? "\"{$filters}\"\n" : null; ?> |
|
64 | 64 | ), |
65 | -<?php endforeach;?> |
|
65 | +<?php endforeach; ?> |
|
66 | 66 | ); |
67 | 67 | |
68 | 68 | /** |
69 | 69 | * @see <?=$this->config->namespace?>Model_EntityAbstract::$_validators |
70 | 70 | */ |
71 | 71 | protected $_validators= array( |
72 | -<?php foreach ( $objTables->getColumns () as $column ): ?> |
|
72 | +<?php foreach ($objTables->getColumns() as $column): ?> |
|
73 | 73 | <?php |
74 | - $validators = array (); |
|
74 | + $validators = array(); |
|
75 | 75 | |
76 | - $validators[] = $column->isNullable () ? "'allowEmpty' => true" : "'NotEmpty'"; |
|
76 | + $validators[] = $column->isNullable() ? "'allowEmpty' => true" : "'NotEmpty'"; |
|
77 | 77 | |
78 | - switch ( ucfirst ( $column->getType () ) ) |
|
78 | + switch (ucfirst($column->getType())) |
|
79 | 79 | { |
80 | 80 | case 'String': |
81 | - if ( $column->getMaxLength () ) |
|
81 | + if ($column->getMaxLength()) |
|
82 | 82 | { |
83 | - $validators[] = "array( 'StringLength', array( 'max' => " . $column->getMaxLength () . " ) )"; |
|
83 | + $validators[] = "array( 'StringLength', array( 'max' => " . $column->getMaxLength() . " ) )"; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | break; |
87 | 87 | case 'Boolean': |
88 | 88 | break; |
89 | 89 | default: |
90 | - $name = ucfirst ( $column->getType () ); |
|
90 | + $name = ucfirst($column->getType()); |
|
91 | 91 | $validators[] = "'$name'"; |
92 | 92 | break; |
93 | 93 | } |
94 | - $validators = implode ( ", ", $validators )?> |
|
95 | - '<?= $column->getName () ?>' => array ( |
|
96 | - <?=( !empty( $validators ) ) ? "{$validators}\n" : null?> |
|
94 | + $validators = implode(", ", $validators)?> |
|
95 | + '<?= $column->getName() ?>' => array ( |
|
96 | + <?=( ! empty($validators)) ? "{$validators}\n" : null?> |
|
97 | 97 | ), |
98 | 98 | <?php endforeach; ?> |
99 | 99 | ); |
100 | 100 | |
101 | -<?php if( $objTables->hasPrimaryKey() ):?> |
|
101 | +<?php if ($objTables->hasPrimaryKey()):?> |
|
102 | 102 | /** |
103 | 103 | * Nome da Primary Key |
104 | 104 | * |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | */ |
108 | 108 | |
109 | 109 | protected $_primary = array( |
110 | - <?php foreach($objTables->getPrimarykeys() as $pks) : ?> |
|
110 | + <?php foreach ($objTables->getPrimarykeys() as $pks) : ?> |
|
111 | 111 | '<?=$pks->getName()?>', |
112 | 112 | <?php endforeach ?> |
113 | 113 | ); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | protected $_parent_<?=$parent['name']?>; |
123 | 123 | |
124 | -<?php endforeach;?> |
|
124 | +<?php endforeach; ?> |
|
125 | 125 | <?php foreach ($depends as $depend): ?> |
126 | 126 | /** |
127 | 127 | * Depends relation <?=\Classes\Maker\AbstractMaker::getClassName($depend['table']) . "\n"?> |
@@ -130,13 +130,13 @@ discard block |
||
130 | 130 | */ |
131 | 131 | protected $_depend_<?=$depend['name']?>; |
132 | 132 | |
133 | -<?php endforeach;?> |
|
133 | +<?php endforeach; ?> |
|
134 | 134 | <?php foreach ($objTables->getColumns() as $column): ?> |
135 | 135 | /** |
136 | 136 | * |
137 | - * Sets column <?=$column->getName()."\n"?> |
|
137 | + * Sets column <?=$column->getName() . "\n"?> |
|
138 | 138 | * |
139 | -<?php if ($column->getType()=='date'): ?> |
|
139 | +<?php if ($column->getType() == 'date'): ?> |
|
140 | 140 | * Stored in ISO 8601 format. |
141 | 141 | * |
142 | 142 | * @param string|Zend_Date $<?=$column->getName() . "\n"?> |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | */ |
148 | 148 | public function set<?=\Classes\Maker\AbstractMaker::getClassName($column->getName())?>($<?=$column->getName()?>) |
149 | 149 | { |
150 | -<?php switch ( $column->getType () ): |
|
150 | +<?php switch ($column->getType()): |
|
151 | 151 | case 'date': ?> |
152 | 152 | if (! empty($<?=$column->getName()?>)) |
153 | 153 | { |
@@ -186,16 +186,16 @@ discard block |
||
186 | 186 | /** |
187 | 187 | * Gets column <?=$column->getName() . "\n"?> |
188 | 188 | * |
189 | -<?php if ($column->getType()=='date'): ?> |
|
189 | +<?php if ($column->getType() == 'date'): ?> |
|
190 | 190 | * @param boolean $returnZendDate |
191 | 191 | * @return Zend_Date|null|string Zend_Date representation of this datetime if enabled, or ISO 8601 string if not |
192 | 192 | <?php else: ?> |
193 | 193 | * @return <?=$column->getType() . "\n"?> |
194 | 194 | <?php endif; ?> |
195 | 195 | */ |
196 | - public function get<?=\Classes\Maker\AbstractMaker::getClassName($column->getName())?>(<?php if ($column->getType()=='date'): ?>$returnZendDate = false <?php endif;?>) |
|
196 | + public function get<?=\Classes\Maker\AbstractMaker::getClassName($column->getName())?>(<?php if ($column->getType() == 'date'): ?>$returnZendDate = false <?php endif; ?>) |
|
197 | 197 | { |
198 | -<?php if ($column->getType()=='date'): ?> |
|
198 | +<?php if ($column->getType() == 'date'): ?> |
|
199 | 199 | if ($returnZendDate) |
200 | 200 | { |
201 | 201 | if ($this->_data['<?=$column->getName()?>'] === null) |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | { |
222 | 222 | if ($this->_parent_<?=$parent['name']?> === null) |
223 | 223 | { |
224 | - $this->_parent_<?=$parent['name']?> = $this->findParentRow('<?=$objTables->getNamespace()?>_DbTable_<?=\Classes\Maker\AbstractMaker::getClassName ($parent['table'])?>', '<?=\Classes\Maker\AbstractMaker::getClassName($parent['name'])?>'); |
|
224 | + $this->_parent_<?=$parent['name']?> = $this->findParentRow('<?=$objTables->getNamespace()?>_DbTable_<?=\Classes\Maker\AbstractMaker::getClassName($parent['table'])?>', '<?=\Classes\Maker\AbstractMaker::getClassName($parent['name'])?>'); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | return $this->_parent_<?=$parent['name']?>; |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | { |
241 | 241 | if ($this->_depend_<?=$depend['name']?> === null) |
242 | 242 | { |
243 | - $this->_depend_<?=$depend['name']?> = $this->findDependentRowset('<?=$objTables->getNamespace()?>_DbTable_<?=\Classes\Maker\AbstractMaker::getClassName ($depend['table'])?>'); |
|
243 | + $this->_depend_<?=$depend['name']?> = $this->findDependentRowset('<?=$objTables->getNamespace()?>_DbTable_<?=\Classes\Maker\AbstractMaker::getClassName($depend['table'])?>'); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | return $this->_depend_<?=$depend['name']?>; |
@@ -3,19 +3,19 @@ |
||
3 | 3 | /** |
4 | 4 | * Data Entity implementation for this class |
5 | 5 | * |
6 | - * <?=$this->config->last_modify."\n"?> |
|
6 | + * <?=$this->config->last_modify . "\n"?> |
|
7 | 7 | * |
8 | 8 | * @package <?=$objTables->getNamespace()?> |
9 | - * @see <?=$objTables->getNamespace()?>_Entity_<?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () )?>. <?="\n"?> |
|
9 | + * @see <?=$objTables->getNamespace()?>_Entity_<?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName())?>. <?="\n"?> |
|
10 | 10 | * |
11 | - * @author <?=$this->config->author."\n"?> |
|
11 | + * @author <?=$this->config->author . "\n"?> |
|
12 | 12 | * |
13 | - * @copyright <?=$this->config->copyright."\n"?> |
|
14 | - * @license <?=$this->config->license."\n"?> |
|
15 | - * @link <?=$this->config->link."\n"?> |
|
13 | + * @copyright <?=$this->config->copyright . "\n"?> |
|
14 | + * @license <?=$this->config->license . "\n"?> |
|
15 | + * @link <?=$this->config->link . "\n"?> |
|
16 | 16 | */ |
17 | 17 | |
18 | -class <?=$objTables->getNamespace()?>_<?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () )?> extends <?=$objTables->getNamespace()?>_Entity_<?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () ). "\n"?> |
|
18 | +class <?=$objTables->getNamespace()?>_<?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName())?> extends <?=$objTables->getNamespace()?>_Entity_<?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName()) . "\n"?> |
|
19 | 19 | { |
20 | 20 | /* Codifique aqui */ |
21 | 21 | } |
@@ -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 |
@@ -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 | } |