@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | $parents[] = array ( |
63 | 63 | 'class' => $makerFile->getConfig () |
64 | 64 | ->createClassNamespace ( $constrant ) |
65 | - . ZendFrameworkOne::SEPARETOR |
|
66 | - . AbstractMaker::getClassName ( $constrant->getTable () ) , |
|
65 | + . ZendFrameworkOne::SEPARETOR |
|
66 | + . AbstractMaker::getClassName ( $constrant->getTable () ) , |
|
67 | 67 | 'function' => AbstractMaker::getClassName ( $name ) , |
68 | 68 | 'table' => $constrant->getTable () , |
69 | 69 | 'column' => $objColumn->getName () , |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | $depends[] = array ( |
104 | 104 | 'class' => $makerFile->getConfig () |
105 | 105 | ->createClassNamespace ( $dependence ) |
106 | - . ZendFrameworkOne::SEPARETOR |
|
107 | - . AbstractMaker::getClassName ( $dependence->getTable () ) , |
|
106 | + . ZendFrameworkOne::SEPARETOR |
|
107 | + . AbstractMaker::getClassName ( $dependence->getTable () ) , |
|
108 | 108 | 'function' => AbstractMaker::getClassName ( $name ) , |
109 | 109 | 'table' => $dependence->getTable () , |
110 | 110 | 'column' => $dependence->getColumn () , |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | protected $fileTpl = "entity.php"; |
23 | 23 | protected $overwrite = true; |
24 | 24 | |
25 | - protected $validFunc = array (); |
|
25 | + protected $validFunc = array(); |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * @param \Classes\MakerFile $makerFile |
@@ -30,11 +30,11 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @return array |
32 | 32 | */ |
33 | - public function parseRelation ( \Classes\MakerFile $makerFile , \Classes\Db\DbTable $dbTable ) |
|
33 | + public function parseRelation(\Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable) |
|
34 | 34 | { |
35 | - return array ( |
|
36 | - 'parents' => $this->listParents ( $makerFile , $dbTable ) , |
|
37 | - 'depends' => $this->listDependence ( $makerFile , $dbTable ) |
|
35 | + return array( |
|
36 | + 'parents' => $this->listParents($makerFile, $dbTable), |
|
37 | + 'depends' => $this->listDependence($makerFile, $dbTable) |
|
38 | 38 | ); |
39 | 39 | } |
40 | 40 | |
@@ -44,32 +44,32 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @return array |
46 | 46 | */ |
47 | - private function listParents ( \Classes\MakerFile $makerFile , \Classes\Db\DbTable $dbTable ) |
|
47 | + private function listParents(\Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable) |
|
48 | 48 | { |
49 | - $parents = array (); |
|
50 | - foreach ( $dbTable->getForeingkeys () as $objColumn ) |
|
49 | + $parents = array(); |
|
50 | + foreach ($dbTable->getForeingkeys() as $objColumn) |
|
51 | 51 | { |
52 | - $constrant = $objColumn->getFks (); |
|
52 | + $constrant = $objColumn->getFks(); |
|
53 | 53 | $name = |
54 | 54 | 'Parent' |
55 | 55 | . ZendFrameworkOne::SEPARETOR |
56 | - . AbstractMaker::getClassName ( $constrant->getTable () ) |
|
56 | + . AbstractMaker::getClassName($constrant->getTable()) |
|
57 | 57 | . ZendFrameworkOne::SEPARETOR |
58 | 58 | . 'By' |
59 | 59 | . ZendFrameworkOne::SEPARETOR |
60 | - . $objColumn->getName (); |
|
60 | + . $objColumn->getName(); |
|
61 | 61 | |
62 | - $parents[] = array ( |
|
63 | - 'class' => $makerFile->getConfig () |
|
64 | - ->createClassNamespace ( $constrant ) |
|
62 | + $parents[] = array( |
|
63 | + 'class' => $makerFile->getConfig() |
|
64 | + ->createClassNamespace($constrant) |
|
65 | 65 | . ZendFrameworkOne::SEPARETOR |
66 | - . AbstractMaker::getClassName ( $constrant->getTable () ) , |
|
67 | - 'function' => AbstractMaker::getClassName ( $name ) , |
|
68 | - 'table' => $constrant->getTable () , |
|
69 | - 'column' => $objColumn->getName () , |
|
70 | - 'name' => $constrant->getNameConstrant () , |
|
66 | + . AbstractMaker::getClassName($constrant->getTable()), |
|
67 | + 'function' => AbstractMaker::getClassName($name), |
|
68 | + 'table' => $constrant->getTable(), |
|
69 | + 'column' => $objColumn->getName(), |
|
70 | + 'name' => $constrant->getNameConstrant(), |
|
71 | 71 | ); |
72 | - unset( $name ); |
|
72 | + unset($name); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | return $parents; |
@@ -81,37 +81,37 @@ discard block |
||
81 | 81 | * |
82 | 82 | * @return array |
83 | 83 | */ |
84 | - private function listDependence ( \Classes\MakerFile $makerFile , \Classes\Db\DbTable $dbTable ) |
|
84 | + private function listDependence(\Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable) |
|
85 | 85 | { |
86 | - $depends = array (); |
|
87 | - foreach ( $dbTable->getDependences () as $objColumn ) |
|
86 | + $depends = array(); |
|
87 | + foreach ($dbTable->getDependences() as $objColumn) |
|
88 | 88 | { |
89 | - foreach ( $objColumn->getDependences () as $dependence ) |
|
89 | + foreach ($objColumn->getDependences() as $dependence) |
|
90 | 90 | { |
91 | 91 | $name = |
92 | 92 | 'Depend' |
93 | 93 | . ZendFrameworkOne::SEPARETOR |
94 | - . AbstractMaker::getClassName ( $dependence->getTable () ) |
|
94 | + . AbstractMaker::getClassName($dependence->getTable()) |
|
95 | 95 | . ZendFrameworkOne::SEPARETOR |
96 | 96 | . 'By' |
97 | 97 | . ZendFrameworkOne::SEPARETOR |
98 | - . $objColumn->getName (); |
|
98 | + . $objColumn->getName(); |
|
99 | 99 | |
100 | - if ( ! key_exists ( $name , $this->validFunc ) ) |
|
100 | + if ( ! key_exists($name, $this->validFunc)) |
|
101 | 101 | { |
102 | - $this->validFunc[ $name ] = true; |
|
103 | - $depends[] = array ( |
|
104 | - 'class' => $makerFile->getConfig () |
|
105 | - ->createClassNamespace ( $dependence ) |
|
102 | + $this->validFunc[$name] = true; |
|
103 | + $depends[] = array( |
|
104 | + 'class' => $makerFile->getConfig() |
|
105 | + ->createClassNamespace($dependence) |
|
106 | 106 | . ZendFrameworkOne::SEPARETOR |
107 | - . AbstractMaker::getClassName ( $dependence->getTable () ) , |
|
108 | - 'function' => AbstractMaker::getClassName ( $name ) , |
|
109 | - 'table' => $dependence->getTable () , |
|
110 | - 'column' => $dependence->getColumn () , |
|
111 | - 'name' => $dependence->getNameConstrant () |
|
107 | + . AbstractMaker::getClassName($dependence->getTable()), |
|
108 | + 'function' => AbstractMaker::getClassName($name), |
|
109 | + 'table' => $dependence->getTable(), |
|
110 | + 'column' => $dependence->getColumn(), |
|
111 | + 'name' => $dependence->getNameConstrant() |
|
112 | 112 | ); |
113 | 113 | } |
114 | - unset( $name ); |
|
114 | + unset($name); |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 |
@@ -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 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | protected $fileTpl = "entity.php"; |
21 | 21 | protected $overwrite = true; |
22 | 22 | |
23 | - protected $validFunc = array (); |
|
23 | + protected $validFunc = array(); |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * @param \Classes\MakerFile $makerFile |
@@ -28,12 +28,12 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @return array |
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 | |
34 | - return array ( |
|
35 | - 'mapParents' => $this->listParents ( $makerFile , $dbTable ) , |
|
36 | - 'mapDependents' => $this->listDependence ( $makerFile , $dbTable ) |
|
34 | + return array( |
|
35 | + 'mapParents' => $this->listParents($makerFile, $dbTable), |
|
36 | + 'mapDependents' => $this->listDependence($makerFile, $dbTable) |
|
37 | 37 | ); |
38 | 38 | } |
39 | 39 | |
@@ -43,27 +43,27 @@ discard block |
||
43 | 43 | * |
44 | 44 | * @return array |
45 | 45 | */ |
46 | - private function listParents ( \Classes\MakerFile $makerFile , \Classes\Db\DbTable $dbTable ) |
|
46 | + private function listParents(\Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable) |
|
47 | 47 | { |
48 | 48 | $mapParents = ''; |
49 | - $references = array (); |
|
50 | - foreach ( $dbTable->getForeingkeys () as $objColumn ) |
|
49 | + $references = array(); |
|
50 | + foreach ($dbTable->getForeingkeys() as $objColumn) |
|
51 | 51 | { |
52 | - $constrant = $objColumn->getFks (); |
|
53 | - $references[] = sprintf ( |
|
54 | - "\$this->hasMany('%s', '%s', '%s')" , |
|
55 | - $objColumn->getName () , |
|
56 | - $makerFile->getConfig ()->createClassNamespace ( $constrant ) |
|
52 | + $constrant = $objColumn->getFks(); |
|
53 | + $references[] = sprintf( |
|
54 | + "\$this->hasMany('%s', '%s', '%s')", |
|
55 | + $objColumn->getName(), |
|
56 | + $makerFile->getConfig()->createClassNamespace($constrant) |
|
57 | 57 | . Phalcon::SEPARETOR |
58 | - . AbstractMaker::getClassName ( $constrant->getTable () ) , |
|
59 | - $constrant->getColumn () |
|
58 | + . AbstractMaker::getClassName($constrant->getTable()), |
|
59 | + $constrant->getColumn() |
|
60 | 60 | |
61 | 61 | ); |
62 | 62 | } |
63 | 63 | |
64 | - if ( sizeof ( $references ) > 0 ) |
|
64 | + if (sizeof($references) > 0) |
|
65 | 65 | { |
66 | - $mapParents = join ( ";\n\t\t" , $references ) . ";\n"; |
|
66 | + $mapParents = join(";\n\t\t", $references) . ";\n"; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | |
@@ -76,29 +76,29 @@ discard block |
||
76 | 76 | * |
77 | 77 | * @return array |
78 | 78 | */ |
79 | - private function listDependence ( \Classes\MakerFile $makerFile , \Classes\Db\DbTable $dbTable ) |
|
79 | + private function listDependence(\Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable) |
|
80 | 80 | { |
81 | 81 | $mapDependence = ''; |
82 | - $references = array (); |
|
83 | - foreach ( $dbTable->getDependences () as $objColumn ) |
|
82 | + $references = array(); |
|
83 | + foreach ($dbTable->getDependences() as $objColumn) |
|
84 | 84 | { |
85 | - foreach ( $objColumn->getDependences () as $dependence ) |
|
85 | + foreach ($objColumn->getDependences() as $dependence) |
|
86 | 86 | { |
87 | - $references[] = sprintf ( |
|
88 | - "\$this->belongsTo('%s', '%s', '%s')" , |
|
89 | - $objColumn->getName () , |
|
90 | - $makerFile->getConfig ()->createClassNamespace ( $dependence ) |
|
87 | + $references[] = sprintf( |
|
88 | + "\$this->belongsTo('%s', '%s', '%s')", |
|
89 | + $objColumn->getName(), |
|
90 | + $makerFile->getConfig()->createClassNamespace($dependence) |
|
91 | 91 | . Phalcon::SEPARETOR |
92 | - . AbstractMaker::getClassName ( $dependence->getTable () ) , |
|
93 | - $dependence->getColumn () |
|
92 | + . AbstractMaker::getClassName($dependence->getTable()), |
|
93 | + $dependence->getColumn() |
|
94 | 94 | ); |
95 | 95 | |
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
99 | - if ( sizeof ( $references ) > 0 ) |
|
99 | + if (sizeof($references) > 0) |
|
100 | 100 | { |
101 | - $mapDependence = join ( ";\n\t\t" , $references ) . ";"; |
|
101 | + $mapDependence = join(";\n\t\t", $references) . ";"; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | return $mapDependence; |
@@ -3,43 +3,43 @@ discard block |
||
3 | 3 | /** |
4 | 4 | * Mvc Model |
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 | namespace <?=$objTables->getNamespace()?>\Entity; |
18 | 18 | |
19 | 19 | use Phalcon\Mvc\Model; |
20 | 20 | |
21 | -class <?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () )?> extends Model |
|
21 | +class <?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName())?> extends Model |
|
22 | 22 | { |
23 | 23 | |
24 | 24 | <?php foreach ($objTables->getColumns() as $column): ?> |
25 | 25 | /** |
26 | - * column <?=$column->getName()."\n"?> |
|
26 | + * column <?=$column->getName() . "\n"?> |
|
27 | 27 | * |
28 | -<?php if($column->isPrimaryKey()):?> |
|
28 | +<?php if ($column->isPrimaryKey()):?> |
|
29 | 29 | * @Primary |
30 | 30 | <?php endif ?> |
31 | -<?php if($column->hasSequence()):?> |
|
31 | +<?php if ($column->hasSequence()):?> |
|
32 | 32 | * @Identity |
33 | 33 | <?php endif ?> |
34 | - * @Column(type="<?=$column->getType()?>", nullable=<?=$column->isNullable () ? "true" : "false"?><?php |
|
35 | -if ( $column->getMaxLength () ): ?> |
|
36 | -, length=<?=$column->getMaxLength ()?> |
|
34 | + * @Column(type="<?=$column->getType()?>", nullable=<?=$column->isNullable() ? "true" : "false"?><?php |
|
35 | +if ($column->getMaxLength()): ?> |
|
36 | +, length=<?=$column->getMaxLength()?> |
|
37 | 37 | <?php endif ?>) |
38 | 38 | */ |
39 | 39 | protected $<?=$column->getName()?>; |
40 | 40 | |
41 | -<?php endforeach;?> |
|
42 | -<?php if($objTables->hasSchema()): ?> |
|
41 | +<?php endforeach; ?> |
|
42 | +<?php if ($objTables->hasSchema()): ?> |
|
43 | 43 | public function getSchema() |
44 | 44 | { |
45 | 45 | return '<?=$objTables->getSchema()?>'; |
@@ -49,15 +49,15 @@ discard block |
||
49 | 49 | public function initialize() |
50 | 50 | { |
51 | 51 | parent::initialize(); |
52 | - <?=$mapParents."\n"?> |
|
53 | - <?=$mapDependents."\n"?> |
|
52 | + <?=$mapParents . "\n"?> |
|
53 | + <?=$mapDependents . "\n"?> |
|
54 | 54 | } |
55 | 55 | |
56 | -<?php if( $objTables->hasSequences() ) : ?> |
|
56 | +<?php if ($objTables->hasSequences()) : ?> |
|
57 | 57 | public function getSequenceName() |
58 | 58 | { |
59 | -<?php if ( 1 == count($objTables->getSequences() ) ) : ?> |
|
60 | - <?php $seqs = $objTables->getSequences();reset($seqs);$seq = current($seqs);?> |
|
59 | +<?php if (1 == count($objTables->getSequences())) : ?> |
|
60 | + <?php $seqs = $objTables->getSequences(); reset($seqs); $seq = current($seqs); ?> |
|
61 | 61 | return "<?=$seq->getSequence() ?>"; |
62 | 62 | <?php endif ?> |
63 | 63 | } |
@@ -3,19 +3,19 @@ |
||
3 | 3 | /** |
4 | 4 | * Data Model 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()?>/Model/<?=$this->getClassName ( $objTables->getName () )?>. "\n"?> |
|
9 | + * @see <?=$objTables->getNamespace()?>/Model/<?=$this->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 <?=$this->getClassName ( $objTables->getName () )?> extends <?=$objTables->getNamespace()?>\Entity\<?=$this->getClassName ( $objTables->getName () ). "\n"?> |
|
18 | +class <?=$this->getClassName($objTables->getName())?> extends <?=$objTables->getNamespace()?>\Entity\<?=$this->getClassName($objTables->getName()) . "\n"?> |
|
19 | 19 | { |
20 | 20 | /* Codifique aqui */ |
21 | 21 | } |
@@ -3,20 +3,20 @@ discard block |
||
3 | 3 | /** |
4 | 4 | * Application Model DbTables |
5 | 5 | * |
6 | - * <?=$this->config->last_modify."\n"?> |
|
6 | + * <?=$this->config->last_modify . "\n"?> |
|
7 | 7 | * |
8 | 8 | * Tabela definida por 'tablename' |
9 | 9 | * |
10 | 10 | * @package <?=$objTables->getNamespace()?><?="\n"?> |
11 | 11 | * @subpackage DbTable |
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 | -class <?=$objTables->getNamespace()?>_DbTable_<?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () )?> extends <?=$this->config->namespace?>Model_<?=$objMakeFile->getParentClass() . "\n"?> |
|
19 | +class <?=$objTables->getNamespace()?>_DbTable_<?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName())?> extends <?=$this->config->namespace?>Model_<?=$objMakeFile->getParentClass() . "\n"?> |
|
20 | 20 | { |
21 | 21 | /** |
22 | 22 | * Nome da tabela do banco de dados |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * @access protected |
26 | 26 | */ |
27 | 27 | protected $_name = '<?=$objTables->getName()?>'; |
28 | -<?php if($objTables->hasSchema()): ?> |
|
28 | +<?php if ($objTables->hasSchema()): ?> |
|
29 | 29 | |
30 | 30 | /** |
31 | 31 | * Schema da tabela do banco de dados |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | * @var string |
43 | 43 | * @access protected |
44 | 44 | */ |
45 | - protected $_rowClass = '<?=$objTables->getNamespace()?>_<?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () )?>'; |
|
45 | + protected $_rowClass = '<?=$objTables->getNamespace()?>_<?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName())?>'; |
|
46 | 46 | |
47 | -<?php if( $objTables->hasPrimaryKey() ):?> |
|
47 | +<?php if ($objTables->hasPrimaryKey()):?> |
|
48 | 48 | /** |
49 | 49 | * Nome da Primary Key |
50 | 50 | * |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @access protected |
53 | 53 | */ |
54 | 54 | protected $_primary = array( |
55 | -<?php foreach($objTables->getPrimaryKeys() as $pks):?> |
|
55 | +<?php foreach ($objTables->getPrimaryKeys() as $pks):?> |
|
56 | 56 | '<?=$pks->getName()?>', |
57 | 57 | <?php endforeach; ?> |
58 | 58 | ); |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | * |
64 | 64 | * @var mixed |
65 | 65 | */ |
66 | -<?php if( $objTables->hasSequences() ) : ?> |
|
67 | -<?php if ( 1 == count($objTables->getSequences() ) ) : ?> |
|
68 | -<?php $seqs = $objTables->getSequences();reset($seqs);$seq = current($seqs);?> |
|
66 | +<?php if ($objTables->hasSequences()) : ?> |
|
67 | +<?php if (1 == count($objTables->getSequences())) : ?> |
|
68 | +<?php $seqs = $objTables->getSequences(); reset($seqs); $seq = current($seqs); ?> |
|
69 | 69 | protected $_sequence = '<?=$seq->getSequence() ?>'; |
70 | 70 | <?php endif ?> |
71 | 71 | <?php else: ?> |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | /** |
53 | 53 | * @var array |
54 | 54 | */ |
55 | - private $argv = array (); |
|
55 | + private $argv = array(); |
|
56 | 56 | |
57 | 57 | /** |
58 | 58 | * @var \Classes\AdapterConfig\AbstractAdapter |
@@ -64,18 +64,18 @@ discard block |
||
64 | 64 | */ |
65 | 65 | private $adapterDriver; |
66 | 66 | |
67 | - public function __construct ( $argv , $basePath ) |
|
67 | + public function __construct($argv, $basePath) |
|
68 | 68 | { |
69 | - if ( array_key_exists ( 'help' , $argv ) ) |
|
69 | + if (array_key_exists('help', $argv)) |
|
70 | 70 | { |
71 | - die ( $this->getUsage () ); |
|
71 | + die ($this->getUsage()); |
|
72 | 72 | } |
73 | - if ( array_key_exists ( 'status' , $argv ) ) |
|
73 | + if (array_key_exists('status', $argv)) |
|
74 | 74 | { |
75 | - $argv[ 'status' ] = true; |
|
75 | + $argv['status'] = true; |
|
76 | 76 | } |
77 | 77 | |
78 | - $this->argv = $this->parseConfig ( $basePath , $argv ); |
|
78 | + $this->argv = $this->parseConfig($basePath, $argv); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * |
84 | 84 | * @return string |
85 | 85 | */ |
86 | - public function getUsage () |
|
86 | + public function getUsage() |
|
87 | 87 | { |
88 | 88 | $version = $this->getVersion(); |
89 | 89 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | EOF; |
109 | 109 | } |
110 | 110 | |
111 | - public function getVersion () |
|
111 | + public function getVersion() |
|
112 | 112 | { |
113 | 113 | $version = static::$version; |
114 | 114 | |
@@ -124,22 +124,22 @@ discard block |
||
124 | 124 | * @return array |
125 | 125 | * @throws \Exception |
126 | 126 | */ |
127 | - private function parseConfig ( $basePath , $argv ) |
|
127 | + private function parseConfig($basePath, $argv) |
|
128 | 128 | { |
129 | - $this->_basePath = dirname ( $basePath ); |
|
129 | + $this->_basePath = dirname($basePath); |
|
130 | 130 | |
131 | - $configIni = isset( $argv[ 'config-ini' ] ) ? $argv[ 'config-ini' ] |
|
131 | + $configIni = isset($argv['config-ini']) ? $argv['config-ini'] |
|
132 | 132 | : $this->_basePath . $this->configIniDefault; |
133 | 133 | |
134 | - $configTemp = $this->loadIniFile ( realpath ( $configIni ) ); |
|
135 | - $configCurrent = self::parseConfigEnv ( $configTemp , $argv ); |
|
134 | + $configTemp = $this->loadIniFile(realpath($configIni)); |
|
135 | + $configCurrent = self::parseConfigEnv($configTemp, $argv); |
|
136 | 136 | |
137 | - if ( ! isset( $configCurrent[ 'framework' ] ) ) |
|
137 | + if ( ! isset($configCurrent['framework'])) |
|
138 | 138 | { |
139 | - throw new \Exception( "configure which framework you want to use! \n" ); |
|
139 | + throw new \Exception("configure which framework you want to use! \n"); |
|
140 | 140 | } |
141 | 141 | |
142 | - return $argv + array_filter ( $configCurrent ); |
|
142 | + return $argv + array_filter($configCurrent); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | /** |
@@ -149,22 +149,22 @@ discard block |
||
149 | 149 | * |
150 | 150 | * @return string |
151 | 151 | */ |
152 | - private static function parseConfigEnv ( $configTemp , $argv ) |
|
152 | + private static function parseConfigEnv($configTemp, $argv) |
|
153 | 153 | { |
154 | - $thisSection = isset( $configTemp[ key ( $configTemp ) ][ 'config-env' ] ) ? |
|
155 | - $configTemp[ key ( $configTemp ) ][ 'config-env' ] : null; |
|
154 | + $thisSection = isset($configTemp[key($configTemp)]['config-env']) ? |
|
155 | + $configTemp[key($configTemp)]['config-env'] : null; |
|
156 | 156 | |
157 | - $thisSection = isset( $argv[ 'config-env' ] ) ? $argv[ 'config-env' ] |
|
157 | + $thisSection = isset($argv['config-env']) ? $argv['config-env'] |
|
158 | 158 | : $thisSection; |
159 | 159 | |
160 | - if ( isset( $configTemp[ $thisSection ][ 'extends' ] ) ) |
|
160 | + if (isset($configTemp[$thisSection]['extends'])) |
|
161 | 161 | { |
162 | 162 | #faz marge da config principal com a config extendida |
163 | - return $configTemp[ $thisSection ] |
|
164 | - + $configTemp[ $configTemp[ $thisSection ][ 'extends' ] ]; |
|
163 | + return $configTemp[$thisSection] |
|
164 | + + $configTemp[$configTemp[$thisSection]['extends']]; |
|
165 | 165 | } |
166 | 166 | |
167 | - return $configTemp[ key ( $configTemp ) ]; |
|
167 | + return $configTemp[key($configTemp)]; |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | /** |
@@ -178,32 +178,32 @@ discard block |
||
178 | 178 | * @throws \Exception |
179 | 179 | * @return array |
180 | 180 | */ |
181 | - protected function loadIniFile ( $filename ) |
|
181 | + protected function loadIniFile($filename) |
|
182 | 182 | { |
183 | - if ( ! is_file ( $filename ) ) |
|
183 | + if ( ! is_file($filename)) |
|
184 | 184 | { |
185 | - throw new \Exception( "configuration file does not exist! \n" ); |
|
185 | + throw new \Exception("configuration file does not exist! \n"); |
|
186 | 186 | } |
187 | 187 | |
188 | - $loaded = parse_ini_file ( $filename , true ); |
|
189 | - $iniArray = array (); |
|
190 | - foreach ( $loaded as $key => $data ) |
|
188 | + $loaded = parse_ini_file($filename, true); |
|
189 | + $iniArray = array(); |
|
190 | + foreach ($loaded as $key => $data) |
|
191 | 191 | { |
192 | - $pieces = explode ( $this->sectionSeparator , $key ); |
|
193 | - $thisSection = trim ( $pieces[ 0 ] ); |
|
194 | - switch ( count ( $pieces ) ) |
|
192 | + $pieces = explode($this->sectionSeparator, $key); |
|
193 | + $thisSection = trim($pieces[0]); |
|
194 | + switch (count($pieces)) |
|
195 | 195 | { |
196 | 196 | case 1: |
197 | - $iniArray[ $thisSection ] = $data; |
|
197 | + $iniArray[$thisSection] = $data; |
|
198 | 198 | break; |
199 | 199 | |
200 | 200 | case 2: |
201 | - $extendedSection = trim ( $pieces[ 1 ] ); |
|
202 | - $iniArray[ $thisSection ] = array_merge ( array ( 'extends' => $extendedSection ) , $data ); |
|
201 | + $extendedSection = trim($pieces[1]); |
|
202 | + $iniArray[$thisSection] = array_merge(array('extends' => $extendedSection), $data); |
|
203 | 203 | break; |
204 | 204 | |
205 | 205 | default: |
206 | - throw new \Exception( "Section '$thisSection' may not extend multiple sections in $filename" ); |
|
206 | + throw new \Exception("Section '$thisSection' may not extend multiple sections in $filename"); |
|
207 | 207 | } |
208 | 208 | } |
209 | 209 | |
@@ -216,16 +216,16 @@ discard block |
||
216 | 216 | * @return \Classes\AdapterConfig\AbstractAdapter |
217 | 217 | * |
218 | 218 | */ |
219 | - private function factoryConfig () |
|
219 | + private function factoryConfig() |
|
220 | 220 | { |
221 | - switch ( strtolower ( $this->argv[ 'framework' ] ) ) |
|
221 | + switch (strtolower($this->argv['framework'])) |
|
222 | 222 | { |
223 | 223 | case 'zf1': |
224 | - return new ZendFrameworkOne( $this->argv ); |
|
224 | + return new ZendFrameworkOne($this->argv); |
|
225 | 225 | case 'phalcon': |
226 | - return new Phalcon( $this->argv ); |
|
226 | + return new Phalcon($this->argv); |
|
227 | 227 | default: |
228 | - return new None( $this->argv ); |
|
228 | + return new None($this->argv); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | } |
@@ -235,33 +235,33 @@ discard block |
||
235 | 235 | * |
236 | 236 | * @return \Classes\AdapterConfig\AbstractAdapter |
237 | 237 | */ |
238 | - private function factoryDriver () |
|
238 | + private function factoryDriver() |
|
239 | 239 | { |
240 | - switch ( $this->argv[ 'driver' ] ) |
|
240 | + switch ($this->argv['driver']) |
|
241 | 241 | { |
242 | 242 | case 'pgsql': |
243 | 243 | case 'pdo_pgsql': |
244 | - return new Pgsql( $this->getAdapterConfig () ); |
|
244 | + return new Pgsql($this->getAdapterConfig()); |
|
245 | 245 | case 'mysql': |
246 | 246 | case 'pdo_mysql': |
247 | - return new Mysql( $this->getAdapterConfig () ); |
|
247 | + return new Mysql($this->getAdapterConfig()); |
|
248 | 248 | case 'mssql': |
249 | - return new Mssql( $this->getAdapterConfig () ); |
|
249 | + return new Mssql($this->getAdapterConfig()); |
|
250 | 250 | case 'dblib': |
251 | - return new Dblib( $this->getAdapterConfig () ); |
|
251 | + return new Dblib($this->getAdapterConfig()); |
|
252 | 252 | case 'sqlsrv': |
253 | - return new Sqlsrv( $this->getAdapterConfig () ); |
|
253 | + return new Sqlsrv($this->getAdapterConfig()); |
|
254 | 254 | } |
255 | 255 | } |
256 | 256 | |
257 | 257 | /** |
258 | 258 | * @return AdapterConfig\AbstractAdapter |
259 | 259 | */ |
260 | - public function getAdapterConfig () |
|
260 | + public function getAdapterConfig() |
|
261 | 261 | { |
262 | - if ( ! $this->adapterConfig instanceof AbstractAdapter ) |
|
262 | + if ( ! $this->adapterConfig instanceof AbstractAdapter) |
|
263 | 263 | { |
264 | - $this->adapterConfig = $this->factoryConfig (); |
|
264 | + $this->adapterConfig = $this->factoryConfig(); |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | return $this->adapterConfig; |
@@ -270,11 +270,11 @@ discard block |
||
270 | 270 | /** |
271 | 271 | * @return AdaptersDriver\AbsractAdapter |
272 | 272 | */ |
273 | - public function getAdapterDriver () |
|
273 | + public function getAdapterDriver() |
|
274 | 274 | { |
275 | - if ( ! $this->adapterDriver ) |
|
275 | + if ( ! $this->adapterDriver) |
|
276 | 276 | { |
277 | - $this->adapterDriver = $this->factoryDriver (); |
|
277 | + $this->adapterDriver = $this->factoryDriver(); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | return $this->adapterDriver; |