GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#13)
by Pedro
08:52 queued 05:09
created
build/Classes/templates/zf1/entity.php 2 patches
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -140,9 +140,12 @@  discard block
 block discarded – undo
140 140
     * Stored in ISO 8601 format.
141 141
     *
142 142
     * @param string|Zend_Date $<?=$column->getName() . "\n"?>
143
-<?php else: ?>
143
+<?php else {
144
+    : ?>
144 145
     * @param <?=$column->getType()?> $<?=$column->getName() . "\n"?>
145
-<?php endif; ?>
146
+<?php endif;
147
+}
148
+?>
146 149
     * @return <?=$className . "\n"?>
147 150
     */
148 151
     public function set<?=\Classes\Maker\AbstractMaker::getClassName($column->getName())?>($<?=$column->getName()?>)
@@ -189,9 +192,12 @@  discard block
 block discarded – undo
189 192
 <?php if ($column->getType()=='date'): ?>
190 193
     * @param boolean $returnZendDate
191 194
     * @return Zend_Date|null|string Zend_Date representation of this datetime if enabled, or ISO 8601 string if not
192
-<?php else: ?>
195
+<?php else {
196
+    : ?>
193 197
     * @return <?=$column->getType() . "\n"?>
194
-<?php endif; ?>
198
+<?php endif;
199
+}
200
+?>
195 201
     */
196 202
     public function get<?=\Classes\Maker\AbstractMaker::getClassName($column->getName())?>(<?php if ($column->getType()=='date'): ?>$returnZendDate = false <?php endif;?>)
197 203
     {
Please login to merge, or discard this patch.
Spacing   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?= "<?php\n" ?>
2
-<?php $className = $objTables->getNamespace () . '_Entity_' . \Classes\Maker\AbstractMaker::getClassName (
3
-        $objTables->getName ()
2
+<?php $className = $objTables->getNamespace() . '_Entity_' . \Classes\Maker\AbstractMaker::getClassName(
3
+        $objTables->getName()
4 4
     ) ?>
5 5
 
6 6
 /**
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  *
9 9
  * <?= $this->config->last_modify . "\n" ?>
10 10
  *
11
- * @package <?= $objTables->getNamespace () . "\n" ?>
11
+ * @package <?= $objTables->getNamespace() . "\n" ?>
12 12
  * @subpackage Entity
13 13
  *
14 14
  * @author    <?= $this->config->author . "\n" ?>
@@ -24,16 +24,16 @@  discard block
 block discarded – undo
24 24
  */
25 25
 
26 26
 abstract class <?= $className ?> extends <?= $this->config->namespace ? $this->config->namespace
27
-                                                                        . "_" : "" ?>Model_<?= $objMakeFile->getParentClass (
27
+                                                                        . "_" : "" ?>Model_<?= $objMakeFile->getParentClass(
28 28
 ) . "\n" ?>
29 29
 {
30 30
 
31
-<?php foreach ( $objTables->getColumns () as $column ): ?>
31
+<?php foreach ($objTables->getColumns() as $column): ?>
32 32
     /**
33
-     * Database constraint in the column <?= $column->getName () . "\n" ?>
33
+     * Database constraint in the column <?= $column->getName() . "\n" ?>
34 34
      *
35 35
      */
36
-    const <?= strtoupper ( $column->getName () ) ?> = '<?= $objTables->getName () ?>.<?= $column->getName () ?>';
36
+    const <?= strtoupper($column->getName()) ?> = '<?= $objTables->getName() ?>.<?= $column->getName() ?>';
37 37
 <?php endforeach; ?>
38 38
 
39 39
     /**
@@ -42,17 +42,17 @@  discard block
 block discarded – undo
42 42
      * @var string
43 43
      * @access protected
44 44
      */
45
-    protected $_tableClass = '<?= $objTables->getNamespace () ?>_DbTable_<?= \Classes\Maker\AbstractMaker::getClassName (
46
-    $objTables->getName ()
45
+    protected $_tableClass = '<?= $objTables->getNamespace() ?>_DbTable_<?= \Classes\Maker\AbstractMaker::getClassName(
46
+    $objTables->getName()
47 47
 ) ?>';
48 48
 
49 49
     /**
50 50
      * @see <?= $this->config->namespace ?>Model_EntityAbstract::$_columnsList
51 51
      */
52 52
     protected $_columnsList = array(
53
-<?php foreach ( $objTables->getColumns () as $column ): ?>
54
-        self::<?= strtoupper ( $column->getName () ) ?> => '<?= strtolower (
55
-            \Classes\Maker\AbstractMaker::getClassName ( $column->getName () )
53
+<?php foreach ($objTables->getColumns() as $column): ?>
54
+        self::<?= strtoupper($column->getName()) ?> => '<?= strtolower(
55
+            \Classes\Maker\AbstractMaker::getClassName($column->getName())
56 56
     ) ?>',
57 57
 <?php endforeach; ?>
58 58
     );
@@ -61,10 +61,10 @@  discard block
 block discarded – undo
61 61
      * @see <?= $this->config->namespace ?>Model_EntityAbstract::$_filters
62 62
      */
63 63
     protected $_filters = array(
64
-<?php foreach ( $objTables->getColumns () as $column ): ?>
64
+<?php foreach ($objTables->getColumns() as $column): ?>
65 65
 <?php
66 66
     $filters = null;
67
-    switch ( ucfirst ( $column->getType () ) ) {
67
+    switch (ucfirst($column->getType())) {
68 68
         case 'String':
69 69
             $filters = 'StripTags", "StringTrim';
70 70
             break;
@@ -74,12 +74,12 @@  discard block
 block discarded – undo
74 74
         case 'Date':
75 75
             break;
76 76
         default:
77
-            $filters = ucfirst ( $column->getType () );
77
+            $filters = ucfirst($column->getType());
78 78
             break;
79 79
     }
80 80
     ?>
81
-    '<?= $column->getName () ?>' => array (
82
-            <?= ( !empty( $filters ) ) ? "\"{$filters}\"\n" : null; ?>
81
+    '<?= $column->getName() ?>' => array (
82
+            <?= ( ! empty($filters)) ? "\"{$filters}\"\n" : null; ?>
83 83
         ),
84 84
 <?php endforeach; ?>
85 85
     );
@@ -88,34 +88,34 @@  discard block
 block discarded – undo
88 88
      * @see <?= $this->config->namespace ?>Model_EntityAbstract::$_validators
89 89
      */
90 90
     protected $_validators= array(
91
-<?php foreach ( $objTables->getColumns () as $column ): ?>
91
+<?php foreach ($objTables->getColumns() as $column): ?>
92 92
 <?php
93
-    $validators = array ();
93
+    $validators = array();
94 94
 
95
-    $validators[] = $column->isNullable () ? "'allowEmpty' => true" : "'NotEmpty'";
95
+    $validators[] = $column->isNullable() ? "'allowEmpty' => true" : "'NotEmpty'";
96 96
 
97
-    switch ( ucfirst ( $column->getType () ) ) {
97
+    switch (ucfirst($column->getType())) {
98 98
         case 'String':
99
-            if ( $column->getMaxLength () ) {
100
-                $validators[] = "array( 'StringLength', array( 'max' => " . $column->getMaxLength () . " ) )";
99
+            if ($column->getMaxLength()) {
100
+                $validators[] = "array( 'StringLength', array( 'max' => " . $column->getMaxLength() . " ) )";
101 101
             }
102 102
 
103 103
             break;
104 104
         case 'Boolean':
105 105
             break;
106 106
         default:
107
-            $name         = ucfirst ( $column->getType () );
107
+            $name         = ucfirst($column->getType());
108 108
             $validators[] = "'$name'";
109 109
             break;
110 110
     }
111
-$validators = implode ( ", ", $validators ) ?>
112
-    '<?= $column->getName () ?>' => array (
113
-            <?= ( !empty( $validators ) ) ? "{$validators}\n" : null ?>
111
+$validators = implode(", ", $validators) ?>
112
+    '<?= $column->getName() ?>' => array (
113
+            <?= ( ! empty($validators)) ? "{$validators}\n" : null ?>
114 114
         ),
115 115
 <?php endforeach; ?>
116 116
     );
117 117
 
118
-<?php if ( $objTables->hasPrimaryKey () ): ?>
118
+<?php if ($objTables->hasPrimaryKey()): ?>
119 119
     /**
120 120
     * Nome da Primary Key
121 121
     *
@@ -123,83 +123,83 @@  discard block
 block discarded – undo
123 123
     * @access protected
124 124
     */
125 125
    protected $_primary = array(
126
-<?php foreach ( $objTables->getPrimarykeys () as $pks ) : ?>
127
-        '<?= $pks->getName () ?>',
126
+<?php foreach ($objTables->getPrimarykeys() as $pks) : ?>
127
+        '<?= $pks->getName() ?>',
128 128
 <?php endforeach ?>
129 129
     );
130 130
 <?php endif ?>
131 131
 
132
-<?php foreach ( $parents as $parent ): ?>
132
+<?php foreach ($parents as $parent): ?>
133 133
     /**
134
-     * Parent relation <?= \Classes\Maker\AbstractMaker::getClassName ( $parent[ 'table' ] ) . "\n" ?>
134
+     * Parent relation <?= \Classes\Maker\AbstractMaker::getClassName($parent['table']) . "\n" ?>
135 135
      *
136
-     * - CONSTRAINT in DB <?= $parent[ 'name' ] . "\n" ?>
136
+     * - CONSTRAINT in DB <?= $parent['name'] . "\n" ?>
137 137
      *
138
-     * @var <?= $parent[ 'variable' ] . "\n" ?>
138
+     * @var <?= $parent['variable'] . "\n" ?>
139 139
      */
140
-    protected $_parent_<?= $parent[ 'variable' ] ?>;
140
+    protected $_parent_<?= $parent['variable'] ?>;
141 141
 
142 142
 <?php endforeach; ?>
143
-<?php foreach ( $depends as $depend ): ?>
143
+<?php foreach ($depends as $depend): ?>
144 144
     /**
145
-     * Depends relation <?= \Classes\Maker\AbstractMaker::getClassName ( $depend[ 'table' ] ) . "\n" ?>
145
+     * Depends relation <?= \Classes\Maker\AbstractMaker::getClassName($depend['table']) . "\n" ?>
146 146
      *
147
-     * - CONSTRAINT in DB <?= $depend[ 'name' ] . "\n" ?>
147
+     * - CONSTRAINT in DB <?= $depend['name'] . "\n" ?>
148 148
      *
149
-     * @var <?= $depend[ 'variable' ] . "\n" ?>
149
+     * @var <?= $depend['variable'] . "\n" ?>
150 150
      */
151
-    protected $_depend_<?= $depend[ 'variable' ] ?>;
151
+    protected $_depend_<?= $depend['variable'] ?>;
152 152
 
153 153
 <?php endforeach; ?>
154
-<?php foreach ( $objTables->getColumns () as $column ): ?>
154
+<?php foreach ($objTables->getColumns() as $column): ?>
155 155
     /**
156 156
      *
157
-     * Sets column <?= $column->getName () . "\n" ?>
157
+     * Sets column <?= $column->getName() . "\n" ?>
158 158
      *
159
-<?php if ( $column->equalType ( 'date' ) ): ?>
159
+<?php if ($column->equalType('date')): ?>
160 160
      * Stored in ISO 8601 format.
161 161
      *
162
-     * @param string|Zend_Date $<?= $column->getName () . "\n" ?>
162
+     * @param string|Zend_Date $<?= $column->getName() . "\n" ?>
163 163
 <?php else: ?>
164
-     * @param <?= $column->getType () ?> $<?= $column->getName () . "\n" ?>
164
+     * @param <?= $column->getType() ?> $<?= $column->getName() . "\n" ?>
165 165
 <?php endif; ?>
166 166
      * @return <?= $className . "\n" ?>
167 167
      */
168
-    public function set<?= \Classes\Maker\AbstractMaker::getClassName ( $column->getName () ) ?>($<?= $column->getName (
168
+    public function set<?= \Classes\Maker\AbstractMaker::getClassName($column->getName()) ?>($<?= $column->getName(
169 169
     ) ?>)
170 170
     {
171
-<?php switch ( $column->getType () ):
171
+<?php switch ($column->getType()):
172 172
         case 'date': ?>
173
-            if (! empty($<?= $column->getName () ?>))
173
+            if (! empty($<?= $column->getName() ?>))
174 174
             {
175
-                if (! $<?= $column->getName () ?> instanceof Zend_Date)
175
+                if (! $<?= $column->getName() ?> instanceof Zend_Date)
176 176
                 {
177
-                    $<?= $column->getName () ?> = new Zend_Date($<?= $column->getName () ?>);
177
+                    $<?= $column->getName() ?> = new Zend_Date($<?= $column->getName() ?>);
178 178
                 }
179 179
 
180
-                $this-><?= $column->getName () ?> = $<?= $column->getName () ?>->toString(Zend_Date::ISO_8601);
180
+                $this-><?= $column->getName() ?> = $<?= $column->getName() ?>->toString(Zend_Date::ISO_8601);
181 181
             }
182 182
 
183 183
 <?php break ?>
184 184
 <?php case 'boolean': ?>
185
-            $this-><?= $column->getName () ?> = $<?= $column->getName () ?> ? true : false;
185
+            $this-><?= $column->getName() ?> = $<?= $column->getName() ?> ? true : false;
186 186
 
187 187
 <?php break ?>
188 188
 <?php default: ?>
189
-            $<?= $column->getName () ?> = (<?= ucfirst ( $column->getType () ) ?>) $<?= $column->getName () ?> ;
190
-            $input = new Zend_Filter_Input($this->_filters, $this->_validators, array('<?= $column->getName (
191
-            ) ?>'=>$<?= $column->getName () ?> ));
189
+            $<?= $column->getName() ?> = (<?= ucfirst($column->getType()) ?>) $<?= $column->getName() ?> ;
190
+            $input = new Zend_Filter_Input($this->_filters, $this->_validators, array('<?= $column->getName(
191
+            ) ?>'=>$<?= $column->getName() ?> ));
192 192
 
193
-            if(!$input->isValid ('<?= $column->getName () ?>'))
193
+            if(!$input->isValid ('<?= $column->getName() ?>'))
194 194
             {
195 195
                 $errors =  $input->getMessages ();
196
-                foreach ( $errors['<?= $column->getName () ?>'] as $key => $value )
196
+                foreach ( $errors['<?= $column->getName() ?>'] as $key => $value )
197 197
                 {
198 198
                     throw new Exception ( $value );
199 199
                 }
200 200
             }
201 201
 
202
-            $this-><?= $column->getName () ?>  = $<?= $column->getName () ?> ;
202
+            $this-><?= $column->getName() ?>  = $<?= $column->getName() ?> ;
203 203
 
204 204
 <?php break ?>
205 205
 <?php endswitch ?>
@@ -207,71 +207,71 @@  discard block
 block discarded – undo
207 207
     }
208 208
 
209 209
     /**
210
-     * Gets column <?= $column->getName () . "\n" ?>
210
+     * Gets column <?= $column->getName() . "\n" ?>
211 211
      *
212
-<?php if ( $column->equalType ( 'date' ) ): ?>
212
+<?php if ($column->equalType('date')): ?>
213 213
      * @param boolean $returnZendDate
214 214
      * @return Zend_Date|null|string Zend_Date representation of this datetime if enabled, or ISO 8601 string if not
215 215
 <?php else: ?>
216
-     * @return <?= $column->getType () . "\n" ?>
216
+     * @return <?= $column->getType() . "\n" ?>
217 217
 <?php endif; ?>
218 218
      */
219
-    public function get<?= \Classes\Maker\AbstractMaker::getClassName (
220
-        $column->getName ()
221
-    ) ?>(<?php if ( $column->equalType ( 'date' ) ): ?>$returnZendDate = false <?php endif; ?>)
219
+    public function get<?= \Classes\Maker\AbstractMaker::getClassName(
220
+        $column->getName()
221
+    ) ?>(<?php if ($column->equalType('date')): ?>$returnZendDate = false <?php endif; ?>)
222 222
     {
223
-<?php if ( $column->equalType ( 'date' ) ): ?>
223
+<?php if ($column->equalType('date')): ?>
224 224
         if ($returnZendDate)
225 225
         {
226
-            if ($this->_data['<?= $column->getName () ?>'] === null)
226
+            if ($this->_data['<?= $column->getName() ?>'] === null)
227 227
             {
228 228
                 return null;
229 229
             }
230 230
 
231
-            return new Zend_Date($this-><?= $column->getName () ?>, Zend_Date::ISO_8601);
231
+            return new Zend_Date($this-><?= $column->getName() ?>, Zend_Date::ISO_8601);
232 232
         }
233 233
 <?php endif; ?>
234
-        return $this-><?= $column->getName () ?>;
234
+        return $this-><?= $column->getName() ?>;
235 235
     }
236 236
 
237 237
 <?php endforeach; ?>
238
-<?php foreach ( $parents as $parent ): ?>
238
+<?php foreach ($parents as $parent): ?>
239 239
     /**
240
-     * Gets parent <?= $parent[ 'table' ] . "\n" ?>
240
+     * Gets parent <?= $parent['table'] . "\n" ?>
241 241
      *
242
-     * @return <?= $parent[ 'class' ] . "\n" ?>
242
+     * @return <?= $parent['class'] . "\n" ?>
243 243
      */
244
-    public function get<?= $parent[ 'function' ] ?>()
244
+    public function get<?= $parent['function'] ?>()
245 245
     {
246
-        if ($this->_parent_<?= $parent[ 'variable' ] ?> === null)
246
+        if ($this->_parent_<?= $parent['variable'] ?> === null)
247 247
         {
248
-            $this->_parent_<?= $parent[ 'variable' ] ?> = $this->findParentRow('<?= $objTables->getNamespace (
249
-    ) ?>_DbTable_<?= \Classes\Maker\AbstractMaker::getClassName (
250
-        $parent[ 'table' ]
251
-    ) ?>', '<?= \Classes\Maker\AbstractMaker::getClassName ( $parent[ 'variable' ] ) ?>');
248
+            $this->_parent_<?= $parent['variable'] ?> = $this->findParentRow('<?= $objTables->getNamespace(
249
+    ) ?>_DbTable_<?= \Classes\Maker\AbstractMaker::getClassName(
250
+        $parent['table']
251
+    ) ?>', '<?= \Classes\Maker\AbstractMaker::getClassName($parent['variable']) ?>');
252 252
         }
253 253
 
254
-        return $this->_parent_<?= $parent[ 'variable' ] ?>;
254
+        return $this->_parent_<?= $parent['variable'] ?>;
255 255
     }
256 256
 
257 257
 <?php endforeach; ?>
258 258
 
259 259
 
260
-<?php foreach ( $depends as $depend ): ?>
260
+<?php foreach ($depends as $depend): ?>
261 261
     /**
262
-     * Gets dependent <?= $depend[ 'table' ] . "\n" ?>
262
+     * Gets dependent <?= $depend['table'] . "\n" ?>
263 263
      *
264
-     * @return <?= $depend[ 'class' ] . "\n" ?>
264
+     * @return <?= $depend['class'] . "\n" ?>
265 265
      */
266
-    public function get<?= $depend[ 'function' ] ?>()
266
+    public function get<?= $depend['function'] ?>()
267 267
     {
268
-        if ($this->_depend_<?= $depend[ 'variable' ] ?> === null)
268
+        if ($this->_depend_<?= $depend['variable'] ?> === null)
269 269
         {
270
-            $this->_depend_<?= $depend[ 'variable' ] ?> = $this->findDependentRowset('<?= $objTables->getNamespace (
271
-    ) ?>_DbTable_<?= \Classes\Maker\AbstractMaker::getClassName ( $depend[ 'table' ] ) ?>');
270
+            $this->_depend_<?= $depend['variable'] ?> = $this->findDependentRowset('<?= $objTables->getNamespace(
271
+    ) ?>_DbTable_<?= \Classes\Maker\AbstractMaker::getClassName($depend['table']) ?>');
272 272
         }
273 273
 
274
-        return $this->_depend_<?= $depend[ 'variable' ] ?>;
274
+        return $this->_depend_<?= $depend['variable'] ?>;
275 275
     }
276 276
 
277 277
 <?php endforeach; ?>
Please login to merge, or discard this patch.
build/Classes/MakerFile.php 3 patches
Doc Comments   +5 added lines patch added patch discarded remove patch
@@ -99,6 +99,7 @@  discard block
 block discarded – undo
99 99
 
100 100
     /**
101 101
      * Analisa os caminhos das pastas base
102
+     * @param string $basePath
102 103
      */
103 104
     public function parseLocation ( $basePath )
104 105
     {
@@ -227,6 +228,9 @@  discard block
 block discarded – undo
227 228
         echo "\n\033[1;32mSuccessfully process finished!\n\033[0m";
228 229
     }
229 230
 
231
+    /**
232
+     * @param integer $cur
233
+     */
230 234
     private function waitOfDatabase ( &$cur )
231 235
     {
232 236
         printf ( "\033[1;33mWait, the database is being analyzed..\033[0m\n" );
@@ -293,6 +297,7 @@  discard block
 block discarded – undo
293 297
      * parse a tpl file and return the result
294 298
      *
295 299
      * @param String $tplFile
300
+     * @param AbstractAdapter $objMakeFile
296 301
      *
297 302
      * @return String
298 303
      */
Please login to merge, or discard this patch.
Spacing   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
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
@@ -42,42 +42,42 @@  discard block
 block discarded – undo
42 42
 
43 43
     private $msgReservedWord = "\033[0mPlease enter the value for reserved word \033[0;31m'%index%' \033[1;33m[%config%]:\033[0m ";
44 44
 
45
-    public function __construct ( Config $config )
45
+    public function __construct(Config $config)
46 46
     {
47
-        $this->config = $config->getAdapterConfig ();
48
-        $this->parseReservedWord ( $this->getConfig () );
49
-        $this->driver = $config->getAdapterDriver ( $this->getConfig () );
50
-        $this->parseLocation ( $config->_basePath );
47
+        $this->config = $config->getAdapterConfig();
48
+        $this->parseReservedWord($this->getConfig());
49
+        $this->driver = $config->getAdapterDriver($this->getConfig());
50
+        $this->parseLocation($config->_basePath);
51 51
     }
52 52
 
53 53
     /**
54 54
      * @param AdapterConfig\AbstractAdapter $config
55 55
      */
56
-    public function parseReservedWord ( AdapterConfig\AbstractAdapter $config )
56
+    public function parseReservedWord(AdapterConfig\AbstractAdapter $config)
57 57
     {
58 58
         $palavrasReservadas = $config->reservedWord;
59
-        if ( !$palavrasReservadas ) {
59
+        if ( ! $palavrasReservadas) {
60 60
             return;
61 61
         }
62 62
 
63
-        $schema      = $config->getSchemas ();
64
-        $db          = $config->getDatabase ();
65
-        $hasSchema   = array_intersect ( $schema, array_flip ( $palavrasReservadas ) );
66
-        $hasDatabase = in_array ( $db, $palavrasReservadas );
67
-        if ( !( $hasSchema or $hasDatabase ) ) {
63
+        $schema      = $config->getSchemas();
64
+        $db          = $config->getDatabase();
65
+        $hasSchema   = array_intersect($schema, array_flip($palavrasReservadas));
66
+        $hasDatabase = in_array($db, $palavrasReservadas);
67
+        if ( ! ($hasSchema or $hasDatabase)) {
68 68
             return;
69 69
         }
70 70
 
71 71
         echo "- database has reserved words\n";
72
-        foreach ( $palavrasReservadas as $index => $config ) {
73
-            $attribs = array (
72
+        foreach ($palavrasReservadas as $index => $config) {
73
+            $attribs = array(
74 74
                 "%index%"  => $index,
75 75
                 "%config%" => $config
76 76
             );
77
-            echo strtr ( $this->msgReservedWord, $attribs );
78
-            $line = trim ( fgets ( STDIN ) );
79
-            if ( !empty( $line ) ) {
80
-                $this->getConfig ()->reservedWord[ $index ] = $line;
77
+            echo strtr($this->msgReservedWord, $attribs);
78
+            $line = trim(fgets(STDIN));
79
+            if ( ! empty($line)) {
80
+                $this->getConfig()->reservedWord[$index] = $line;
81 81
             }
82 82
         }
83 83
     }
@@ -87,174 +87,174 @@  discard block
 block discarded – undo
87 87
      *
88 88
      * @return string
89 89
      */
90
-    private function filterLocation ( $arrFoldersName )
90
+    private function filterLocation($arrFoldersName)
91 91
     {
92
-        foreach ( $arrFoldersName as $index => $folderName ) {
93
-            $arrFoldersName[ $index ] = $this->getConfig ()
94
-                                             ->replaceReservedWord ( $folderName );
92
+        foreach ($arrFoldersName as $index => $folderName) {
93
+            $arrFoldersName[$index] = $this->getConfig()
94
+                                             ->replaceReservedWord($folderName);
95 95
         }
96 96
 
97
-        return implode ( DIRECTORY_SEPARATOR, array_filter ( $arrFoldersName ) );
97
+        return implode(DIRECTORY_SEPARATOR, array_filter($arrFoldersName));
98 98
     }
99 99
 
100 100
     /**
101 101
      * Analisa os caminhos das pastas base
102 102
      */
103
-    public function parseLocation ( $basePath )
103
+    public function parseLocation($basePath)
104 104
     {
105 105
 
106
-        $arrBase = array (
106
+        $arrBase = array(
107 107
             $basePath,
108 108
             $this->config->path
109 109
         );
110 110
 
111
-        $this->baseLocation = $this->filterLocation ( $arrBase );
111
+        $this->baseLocation = $this->filterLocation($arrBase);
112 112
 
113 113
         # pasta com nome do driver do banco
114 114
         $driverBase = '';
115
-        if ( (bool) @$this->config->{"folder-database"} ) {
116
-            $classDriver = explode ( '\\', get_class ( $this->driver ) );
117
-            $driverBase  = end ( $classDriver );
115
+        if ((bool) @$this->config->{"folder-database"} ) {
116
+            $classDriver = explode('\\', get_class($this->driver));
117
+            $driverBase  = end($classDriver);
118 118
         }
119 119
         $folderName = '';
120
-        if ( (bool) @$this->config->{"folder-name"} ) {
121
-            $folderName = $this->getClassName ( trim ( $this->config->{"folder-name"} ) );
120
+        if ((bool) @$this->config->{"folder-name"} ) {
121
+            $folderName = $this->getClassName(trim($this->config->{"folder-name"} ));
122 122
         }
123 123
 
124
-        if ( $this->config->hasSchemas () ) {
124
+        if ($this->config->hasSchemas()) {
125 125
 
126
-            $schemas = $this->config->getSchemas ();
127
-            foreach ( $schemas as $schema ) {
128
-                $arrUrl = array (
126
+            $schemas = $this->config->getSchemas();
127
+            foreach ($schemas as $schema) {
128
+                $arrUrl = array(
129 129
                     $this->baseLocation,
130 130
                     $driverBase,
131 131
                     $folderName,
132
-                    $this->getClassName ( $schema )
132
+                    $this->getClassName($schema)
133 133
                 );
134 134
 
135
-                $this->location[ $schema ] = $this->filterLocation ( $arrUrl );
136
-                unset( $arrUrl );
135
+                $this->location[$schema] = $this->filterLocation($arrUrl);
136
+                unset($arrUrl);
137 137
             }
138 138
 
139 139
         }
140 140
         else {
141
-            $url            = array (
141
+            $url = array(
142 142
                 $this->baseLocation,
143 143
                 $driverBase,
144 144
                 $folderName,
145
-                $this->getClassName (
146
-                    $this->getConfig ()
147
-                         ->getDatabase ()
145
+                $this->getClassName(
146
+                    $this->getConfig()
147
+                         ->getDatabase()
148 148
                 )
149 149
             );
150
-            $this->location = array ( $this->filterLocation ( $url ) );
151
-            unset( $url );
150
+            $this->location = array($this->filterLocation($url));
151
+            unset($url);
152 152
         }
153 153
     }
154 154
 
155 155
     /**
156 156
      * @return AdapterConfig\AbstractAdapter
157 157
      */
158
-    public function getConfig ()
158
+    public function getConfig()
159 159
     {
160 160
         return $this->config;
161 161
     }
162 162
 
163 163
     /* Get current time */
164
-    public function startTime ()
164
+    public function startTime()
165 165
     {
166 166
         echo "\033[1;32mStarting..\033[0m\n";
167
-        $this->startTime = microtime ( true );
167
+        $this->startTime = microtime(true);
168 168
     }
169 169
 
170
-    private function getRunTime ()
170
+    private function getRunTime()
171 171
     {
172
-        return round ( ( microtime ( true ) - $this->startTime ), 3 );
172
+        return round((microtime(true) - $this->startTime), 3);
173 173
     }
174 174
 
175 175
     /**
176 176
      * Executa o Make, criando arquivos e Diretorios
177 177
      */
178
-    public function run ()
178
+    public function run()
179 179
     {
180 180
         $cur             = 0;
181 181
         $numFilesCreated = 0;
182 182
         $numFilesIgnored = 0;
183 183
 
184
-        $this->startTime ();
184
+        $this->startTime();
185 185
         $this->waitOfDatabase($cur);
186 186
 
187
-        $this->max       = $this->driver->getTotalTables () * $this->countDiretory ();
187
+        $this->max = $this->driver->getTotalTables() * $this->countDiretory();
188 188
 
189
-        foreach ( $this->location as $schema => $location ) {
190
-            foreach ( $this->factoryMakerFile () as $objMakeFile ) {
191
-                $path = $location . DIRECTORY_SEPARATOR . $objMakeFile->getPastName ();
192
-                self::makeDir ( $path );
193
-                if ( $objMakeFile->getParentFileTpl () != '' ) {
189
+        foreach ($this->location as $schema => $location) {
190
+            foreach ($this->factoryMakerFile() as $objMakeFile) {
191
+                $path = $location . DIRECTORY_SEPARATOR . $objMakeFile->getPastName();
192
+                self::makeDir($path);
193
+                if ($objMakeFile->getParentFileTpl() != '') {
194 194
                     $fileAbstract = $this->baseLocation
195 195
                                     . DIRECTORY_SEPARATOR
196
-                                    . $objMakeFile->getParentClass ()
196
+                                    . $objMakeFile->getParentClass()
197 197
                                     . '.php';
198 198
 
199
-                    $tplAbstract = $this->getParsedTplContents ( $objMakeFile->getParentFileTpl () );
200
-                    self::makeSourcer ( $fileAbstract, $tplAbstract, true );
201
-                    unset( $fileAbstract, $tplAbstract );
199
+                    $tplAbstract = $this->getParsedTplContents($objMakeFile->getParentFileTpl());
200
+                    self::makeSourcer($fileAbstract, $tplAbstract, true);
201
+                    unset($fileAbstract, $tplAbstract);
202 202
                 }
203 203
 
204
-                foreach ( $this->driver->getTables ( $schema ) as $key => $objTables ) {
205
-                    $file = $path . DIRECTORY_SEPARATOR . self::getClassName ( $objTables->getName () ) . '.php';
204
+                foreach ($this->driver->getTables($schema) as $key => $objTables) {
205
+                    $file = $path . DIRECTORY_SEPARATOR . self::getClassName($objTables->getName()) . '.php';
206 206
 
207
-                    $tpl = $this->getParsedTplContents (
208
-                        $objMakeFile->getFileTpl (),
209
-                        $objMakeFile->parseRelation ( $this, $objTables ),
207
+                    $tpl = $this->getParsedTplContents(
208
+                        $objMakeFile->getFileTpl(),
209
+                        $objMakeFile->parseRelation($this, $objTables),
210 210
                         $objTables,
211 211
                         $objMakeFile
212 212
 
213 213
                     );
214
-                    if ( self::makeSourcer ( $file, $tpl, $objMakeFile->isOverwrite () ) ) {
214
+                    if (self::makeSourcer($file, $tpl, $objMakeFile->isOverwrite())) {
215 215
                         ++$numFilesCreated;
216 216
                     }
217 217
                     else {
218 218
                         ++$numFilesIgnored;
219 219
                     }
220 220
 
221
-                    $this->countCreatedFiles ( $cur );
221
+                    $this->countCreatedFiles($cur);
222 222
                 }
223 223
             }
224 224
         }
225 225
 
226
-        $this->reportProcess ( $numFilesCreated, $numFilesIgnored );
226
+        $this->reportProcess($numFilesCreated, $numFilesIgnored);
227 227
         echo "\n\033[1;32mSuccessfully process finished!\n\033[0m";
228 228
     }
229 229
 
230
-    private function waitOfDatabase ( &$cur )
230
+    private function waitOfDatabase(&$cur)
231 231
     {
232
-        printf ( "\033[1;33mWait, the database is being analyzed..\033[0m\n" );
233
-        $this->driver->runDatabase ();
234
-        printf ( "\r Creating: \033[1;32m%6.2f%%\033[0m", $cur );
232
+        printf("\033[1;33mWait, the database is being analyzed..\033[0m\n");
233
+        $this->driver->runDatabase();
234
+        printf("\r Creating: \033[1;32m%6.2f%%\033[0m", $cur);
235 235
     }
236 236
 
237
-    private function countCreatedFiles ( &$cur )
237
+    private function countCreatedFiles(&$cur)
238 238
     {
239 239
         ++$cur;
240
-        $total = ( $cur / $this->max ) * 100;
241
-        printf ( "\r Creating: \033[1;32m%6.2f%%\033[0m", $total );
240
+        $total = ($cur / $this->max) * 100;
241
+        printf("\r Creating: \033[1;32m%6.2f%%\033[0m", $total);
242 242
     }
243 243
 
244
-    private function reportProcess ( $numFilesCreated = 0, $numFilesIgnored = 0 )
244
+    private function reportProcess($numFilesCreated = 0, $numFilesIgnored = 0)
245 245
     {
246
-        if ( $this->config->isStatusEnabled () ) {
247
-            $databases  = count ( $this->location );
248
-            $countDir   = $this->countDiretory ();
249
-            $totalTable = $this->driver->getTotalTables ();
246
+        if ($this->config->isStatusEnabled()) {
247
+            $databases  = count($this->location);
248
+            $countDir   = $this->countDiretory();
249
+            $totalTable = $this->driver->getTotalTables();
250 250
             $totalFiles = $numFilesIgnored + $numFilesCreated;
251 251
             echo "\n------";
252
-            printf ( "\n\r-Files generated/updated: \033[1;33m%s\033[0m", $numFilesCreated );
253
-            printf ( "\n\r-Files not upgradeable: \033[1;33m%s\033[0m", $numFilesIgnored );
254
-            printf ( "\n\r-Total files analyzed: \033[1;33m%s of %s\033[0m", $totalFiles, $this->max );
255
-            printf ( "\n\r-Diretories: \033[1;33m%s\033[0m", $databases * $countDir );
256
-            printf ( "\n\r-Scanned tables: \033[1;33m%s\033[0m", $totalTable );
257
-            printf ( "\n\r-Execution time: \033[1;33m%ssec\033[0m", $this->getRunTime () );
252
+            printf("\n\r-Files generated/updated: \033[1;33m%s\033[0m", $numFilesCreated);
253
+            printf("\n\r-Files not upgradeable: \033[1;33m%s\033[0m", $numFilesIgnored);
254
+            printf("\n\r-Total files analyzed: \033[1;33m%s of %s\033[0m", $totalFiles, $this->max);
255
+            printf("\n\r-Diretories: \033[1;33m%s\033[0m", $databases * $countDir);
256
+            printf("\n\r-Scanned tables: \033[1;33m%s\033[0m", $totalTable);
257
+            printf("\n\r-Execution time: \033[1;33m%ssec\033[0m", $this->getRunTime());
258 258
             echo "\n------";
259 259
         }
260 260
     }
@@ -264,9 +264,9 @@  discard block
 block discarded – undo
264 264
      *
265 265
      * @return AbstractAdapter[]
266 266
      */
267
-    public function factoryMakerFile ()
267
+    public function factoryMakerFile()
268 268
     {
269
-        return $this->config->getMakeFileInstances ();
269
+        return $this->config->getMakeFileInstances();
270 270
     }
271 271
 
272 272
     /**
@@ -274,12 +274,12 @@  discard block
 block discarded – undo
274 274
      *
275 275
      * @return int
276 276
      */
277
-    public function countDiretory ()
277
+    public function countDiretory()
278 278
     {
279
-        if ( null === $this->countDir ) {
279
+        if (null === $this->countDir) {
280 280
             $this->countDir = 1;
281
-            foreach ( $this->factoryMakerFile () as $abstractAdapter ) {
282
-                if ( $abstractAdapter->hasDiretory () ) {
281
+            foreach ($this->factoryMakerFile() as $abstractAdapter) {
282
+                if ($abstractAdapter->hasDiretory()) {
283 283
                     ++$this->countDir;
284 284
                 }
285 285
             }
@@ -296,24 +296,24 @@  discard block
 block discarded – undo
296 296
      *
297 297
      * @return String
298 298
      */
299
-    protected function getParsedTplContents ( $tplFile, $vars = array (), \Classes\Db\DbTable $objTables = null,
300
-                                              $objMakeFile = null )
299
+    protected function getParsedTplContents($tplFile, $vars = array(), \Classes\Db\DbTable $objTables = null,
300
+                                              $objMakeFile = null)
301 301
     {
302 302
 
303
-        $arrUrl = array (
303
+        $arrUrl = array(
304 304
             __DIR__,
305 305
             'templates',
306 306
             $this->config->framework,
307 307
             $tplFile
308 308
         );
309 309
 
310
-        $filePath = implode ( DIRECTORY_SEPARATOR, filter_var_array ( $arrUrl ) );
310
+        $filePath = implode(DIRECTORY_SEPARATOR, filter_var_array($arrUrl));
311 311
 
312
-        extract ( $vars );
313
-        ob_start ();
312
+        extract($vars);
313
+        ob_start();
314 314
         require $filePath;
315
-        $data = ob_get_contents ();
316
-        ob_end_clean ();
315
+        $data = ob_get_contents();
316
+        ob_end_clean();
317 317
 
318 318
         return $data;
319 319
     }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -136,8 +136,7 @@  discard block
 block discarded – undo
136 136
                 unset( $arrUrl );
137 137
             }
138 138
 
139
-        }
140
-        else {
139
+        } else {
141 140
             $url            = array (
142 141
                 $this->baseLocation,
143 142
                 $driverBase,
@@ -213,8 +212,7 @@  discard block
 block discarded – undo
213 212
                     );
214 213
                     if ( self::makeSourcer ( $file, $tpl, $objMakeFile->isOverwrite () ) ) {
215 214
                         ++$numFilesCreated;
216
-                    }
217
-                    else {
215
+                    } else {
218 216
                         ++$numFilesIgnored;
219 217
                     }
220 218
 
Please login to merge, or discard this patch.
build/Classes/AdapterConfig/AbstractAdapter.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -391,7 +391,7 @@
 block discarded – undo
391 391
         $matches = preg_grep ( '*\.*' , $this->getTablesName () );
392 392
         if ( count ( $matches ) )
393 393
         {
394
-           die("error: Table name must not contain the schema\n");
394
+            die("error: Table name must not contain the schema\n");
395 395
         }
396 396
     }
397 397
 
Please login to merge, or discard this patch.
Spacing   +158 added lines, -158 removed lines patch added patch discarded remove patch
@@ -16,85 +16,85 @@  discard block
 block discarded – undo
16 16
 abstract class AbstractAdapter
17 17
 {
18 18
 
19
-    protected $arrConfig = array (
19
+    protected $arrConfig = array(
20 20
         ############################# DATABASE
21 21
         //Driver do banco de dados
22
-        'driver'          => null ,
22
+        'driver'          => null,
23 23
         //Nome do banco de dados
24
-        'database'        => null ,
24
+        'database'        => null,
25 25
         //Host do banco
26
-        'host'            => 'localhost' ,
26
+        'host'            => 'localhost',
27 27
         //Port do banco
28
-        'port'            => '' ,
28
+        'port'            => '',
29 29
         //usuario do banco
30
-        'username'        => null ,
30
+        'username'        => null,
31 31
         //senha do banco
32
-        'password'        => null ,
32
+        'password'        => null,
33 33
         // lista de schemas do banco de dados
34
-        'schema'          => array () ,
35
-        'version'         => '' ,
36
-        'socket'          => null ,
34
+        'schema'          => array(),
35
+        'version'         => '',
36
+        'socket'          => null,
37 37
 
38 38
         ########################### DOCS
39 39
         // autor que gerou o script
40
-        'author'          => "Pedro" ,
41
-        'license'         => "New BSD License" ,
42
-        'copyright'       => "ORM Generator - Pedro151" ,
43
-        'link'            => 'https://github.com/pedro151/orm-generator' ,
44
-        'version'         => '' ,
40
+        'author'          => "Pedro",
41
+        'license'         => "New BSD License",
42
+        'copyright'       => "ORM Generator - Pedro151",
43
+        'link'            => 'https://github.com/pedro151/orm-generator',
44
+        'version'         => '',
45 45
         // data que foi gerado o script
46
-        'last_modify'     => null ,
46
+        'last_modify'     => null,
47 47
 
48 48
         ########################## Ambiente/Arquivos
49 49
 
50 50
         // Nome do framework para o adapter
51
-        'framework'       => null ,
51
+        'framework'       => null,
52 52
         // namespace das classes
53
-        'namespace'       => "" ,
53
+        'namespace'       => "",
54 54
         // caminho onde os arquivos devem ser criados
55
-        'path'            => 'models' ,
55
+        'path'            => 'models',
56 56
         // flag para gerar pasta com o nome do driver do banco de dados
57
-        'folder-database' => 0 ,
57
+        'folder-database' => 0,
58 58
         // string com o nome da pastar personalizada
59
-        'folder-name'     => '' ,
59
+        'folder-name'     => '',
60 60
 
61 61
         ############################## Comandos adicionais
62 62
         //flag para mostrar o status da execução ao termino do processo
63
-        'status'          => false ,
63
+        'status'          => false,
64 64
         // flags para criar todas as tabelas ou nao
65
-        'tables'          => array () ,
65
+        'tables'          => array(),
66 66
         //Lista de tabelas a serem ignoradas
67
-        'ignoreTable'     => array () ,
67
+        'ignoreTable'     => array(),
68 68
     );
69 69
 
70 70
     /**
71 71
      * @var string[] um array com todos os campos obrigatorios
72 72
      */
73
-    protected $attRequered = array (
74
-        'driver'   => true ,
75
-        'database' => true ,
76
-        'host'     => true ,
77
-        'username' => true ,
73
+    protected $attRequered = array(
74
+        'driver'   => true,
75
+        'database' => true,
76
+        'host'     => true,
77
+        'username' => true,
78 78
         'path'     => true
79 79
     );
80 80
 
81
-    protected $arrFunc = array ();
81
+    protected $arrFunc = array();
82 82
 
83
-    private $framworkFiles = array ();
83
+    private $framworkFiles = array();
84 84
 
85
-    public $reservedWord = array ();
85
+    public $reservedWord = array();
86 86
 
87
-    private static $dataTypesDefault = array (
88
-        'int'      => 'int' ,
89
-        'float'    => 'float' ,
90
-        'string'   => 'string' ,
91
-        'text'     => 'string' ,
92
-        'date'     => 'date' ,
93
-        'datetime' => 'date' ,
87
+    private static $dataTypesDefault = array(
88
+        'int'      => 'int',
89
+        'float'    => 'float',
90
+        'string'   => 'string',
91
+        'text'     => 'string',
92
+        'date'     => 'date',
93
+        'datetime' => 'date',
94 94
         'boolean'  => 'boolean'
95 95
     );
96 96
 
97
-    protected $dataTypes = array ();
97
+    protected $dataTypes = array();
98 98
 
99 99
     const SEPARETOR = "";
100 100
 
@@ -103,9 +103,9 @@  discard block
 block discarded – undo
103 103
      *
104 104
      * @return bool
105 105
      */
106
-    protected function checkConfig ()
106
+    protected function checkConfig()
107 107
     {
108
-        if ( array_diff_key ( $this->attRequered , array_filter ( $this->arrConfig ) ) )
108
+        if (array_diff_key($this->attRequered, array_filter($this->arrConfig)))
109 109
         {
110 110
             return false;
111 111
         }
@@ -118,33 +118,33 @@  discard block
 block discarded – undo
118 118
      *
119 119
      * @return array
120 120
      */
121
-    abstract protected function getParams ();
121
+    abstract protected function getParams();
122 122
 
123 123
     /**
124 124
      * Popula as config do generater com as configuraçoes do framework
125 125
      *
126 126
      * @return mixed
127 127
      */
128
-    abstract protected function parseFrameworkConfig ();
128
+    abstract protected function parseFrameworkConfig();
129 129
 
130 130
     /**
131 131
      * Cria Instancias dos arquivos que devem ser gerados
132 132
      *
133 133
      * @return \Classes\AdapterMakerFile\AbstractAdapter[]
134 134
      */
135
-    abstract public function getMakeFileInstances ();
135
+    abstract public function getMakeFileInstances();
136 136
 
137
-    abstract protected function init ();
137
+    abstract protected function init();
138 138
 
139 139
     /**
140 140
      * retorna a base do Namespace
141 141
      *
142 142
      * @return array
143 143
      */
144
-    protected function getBaseNamespace ()
144
+    protected function getBaseNamespace()
145 145
     {
146
-        return array (
147
-            $this->arrConfig[ 'namespace' ] ,
146
+        return array(
147
+            $this->arrConfig['namespace'],
148 148
             'Model'
149 149
         );
150 150
     }
@@ -155,54 +155,54 @@  discard block
 block discarded – undo
155 155
      * @return mixed
156 156
      */
157 157
 
158
-    public function createClassNamespace ( $table )
158
+    public function createClassNamespace($table)
159 159
     {
160
-        $arrNames = $this->getBaseNamespace ();
160
+        $arrNames = $this->getBaseNamespace();
161 161
 
162
-        if ( isset( $this->arrConfig[ 'folder-database' ] )
163
-             && $this->arrConfig[ 'folder-database' ]
162
+        if (isset($this->arrConfig['folder-database'])
163
+             && $this->arrConfig['folder-database']
164 164
         )
165 165
         {
166
-            $arrNames[] = AbstractMaker::getClassName ( $this->arrConfig[ 'driver' ] );
166
+            $arrNames[] = AbstractMaker::getClassName($this->arrConfig['driver']);
167 167
         }
168 168
 
169
-        if ( isset( $this->arrConfig[ 'folder-name' ] )
170
-             && $this->arrConfig[ 'folder-name' ]
169
+        if (isset($this->arrConfig['folder-name'])
170
+             && $this->arrConfig['folder-name']
171 171
         )
172 172
         {
173
-            $arrNames[] = AbstractMaker::getClassName ( $this->arrConfig[ 'folder-name' ] );
173
+            $arrNames[] = AbstractMaker::getClassName($this->arrConfig['folder-name']);
174 174
         }
175 175
 
176
-        if ( $table->hasSchema () )
176
+        if ($table->hasSchema())
177 177
         {
178
-            $arrNames[] = $this->replaceReservedWord ( AbstractMaker::getClassName ( $table->getSchema () ) );
178
+            $arrNames[] = $this->replaceReservedWord(AbstractMaker::getClassName($table->getSchema()));
179 179
         } else
180 180
         {
181
-            $arrNames[] = $this->replaceReservedWord ( AbstractMaker::getClassName ( $table->getDatabase () ) );
181
+            $arrNames[] = $this->replaceReservedWord(AbstractMaker::getClassName($table->getDatabase()));
182 182
         }
183 183
 
184
-        return implode ( static::SEPARETOR , array_filter ( $arrNames ) );
184
+        return implode(static::SEPARETOR, array_filter($arrNames));
185 185
     }
186 186
 
187
-    public function __construct ( $array )
187
+    public function __construct($array)
188 188
     {
189 189
         $this->dataTypes = $this->dataTypes + self::$dataTypesDefault;
190
-        $array += array (
191
-            'version'     => Config::$version ,
192
-            'author'      => ucfirst ( get_current_user () ) ,
193
-            'last_modify' => date ( "d-m-Y H:i:s." )
190
+        $array += array(
191
+            'version'     => Config::$version,
192
+            'author'      => ucfirst(get_current_user()),
193
+            'last_modify' => date("d-m-Y H:i:s.")
194 194
         );
195 195
 
196
-        $this->setFrameworkFiles ( $array );
197
-        $this->parseFrameworkConfig ();
198
-        $this->setParams ( $this->getParams () );
199
-        $this->setParams ( $array );
200
-        $this->init ();
201
-        $this->validTableNames ();
202
-        if ( ! $this->isValid () )
196
+        $this->setFrameworkFiles($array);
197
+        $this->parseFrameworkConfig();
198
+        $this->setParams($this->getParams());
199
+        $this->setParams($array);
200
+        $this->init();
201
+        $this->validTableNames();
202
+        if ( ! $this->isValid())
203 203
         {
204
-            $var = array_diff_key ( $this->attRequered , array_filter ( $this->arrConfig ) );
205
-            throw new Exception( $var );
204
+            $var = array_diff_key($this->attRequered, array_filter($this->arrConfig));
205
+            throw new Exception($var);
206 206
         }
207 207
     }
208 208
 
@@ -211,43 +211,43 @@  discard block
 block discarded – undo
211 211
      *
212 212
      * @param $array
213 213
      */
214
-    public function setFrameworkFiles ( $array )
214
+    public function setFrameworkFiles($array)
215 215
     {
216
-        $this->framworkFiles[ 'library' ] = isset( $array[ 'framework-path-library' ] )
217
-            ? $array[ 'framework-path-library' ] : null;
216
+        $this->framworkFiles['library'] = isset($array['framework-path-library'])
217
+            ? $array['framework-path-library'] : null;
218 218
 
219
-        $this->framworkFiles[ 'ini' ] = isset( $array[ 'framework-ini' ] )
220
-            ? $array[ 'framework-ini' ] : null;
219
+        $this->framworkFiles['ini'] = isset($array['framework-ini'])
220
+            ? $array['framework-ini'] : null;
221 221
 
222
-        $this->framworkFiles[ 'environment' ] = isset( $array[ 'environment' ] )
223
-            ? $array[ 'environment' ] : 'production';
222
+        $this->framworkFiles['environment'] = isset($array['environment'])
223
+            ? $array['environment'] : 'production';
224 224
 
225 225
     }
226 226
 
227
-    protected function isValidFrameworkFiles ()
227
+    protected function isValidFrameworkFiles()
228 228
     {
229
-        if ( ! is_file ( $this->framworkFiles[ 'ini' ] ) )
229
+        if ( ! is_file($this->framworkFiles['ini']))
230 230
         {
231 231
             return false;
232 232
         }
233 233
 
234
-        if ( ! is_dir ( $this->framworkFiles[ 'library' ] ) )
234
+        if ( ! is_dir($this->framworkFiles['library']))
235 235
         {
236 236
             return false;
237 237
         }
238 238
 
239
-        if ( ! isset ( $this->framworkFiles[ 'environment' ] )
240
-             or empty( $this->framworkFiles[ 'environment' ] )
239
+        if ( ! isset ($this->framworkFiles['environment'])
240
+             or empty($this->framworkFiles['environment'])
241 241
         )
242 242
         {
243 243
             return false;
244 244
         }
245
-        set_include_path (
246
-            implode (
247
-                PATH_SEPARATOR ,
248
-                array (
249
-                    realpath ( $this->framworkFiles[ 'library' ] ) ,
250
-                    get_include_path () ,
245
+        set_include_path(
246
+            implode(
247
+                PATH_SEPARATOR,
248
+                array(
249
+                    realpath($this->framworkFiles['library']),
250
+                    get_include_path(),
251 251
                 )
252 252
             )
253 253
         );
@@ -255,112 +255,112 @@  discard block
 block discarded – undo
255 255
         return true;
256 256
     }
257 257
 
258
-    protected function getFrameworkIni ()
258
+    protected function getFrameworkIni()
259 259
     {
260
-        return $this->framworkFiles[ 'ini' ];
260
+        return $this->framworkFiles['ini'];
261 261
     }
262 262
 
263
-    protected function getEnvironment ()
263
+    protected function getEnvironment()
264 264
     {
265
-        return $this->framworkFiles[ 'environment' ];
265
+        return $this->framworkFiles['environment'];
266 266
     }
267 267
 
268 268
     /**
269 269
      * Popula as variaveis de acordo com o arquivo de configuração do seu  framework
270 270
      */
271
-    protected function isValid ()
271
+    protected function isValid()
272 272
     {
273
-        return $this->checkConfig ();
273
+        return $this->checkConfig();
274 274
     }
275 275
 
276
-    private function setParams ( $array )
276
+    private function setParams($array)
277 277
     {
278
-        if ( count ( $array ) > 0 )
278
+        if (count($array) > 0)
279 279
         {
280
-            $this->arrConfig = array_filter ( $array ) + $this->arrConfig;
280
+            $this->arrConfig = array_filter($array) + $this->arrConfig;
281 281
         }
282 282
     }
283 283
 
284 284
     /**
285 285
      * @return string
286 286
      */
287
-    public function getDatabase ()
287
+    public function getDatabase()
288 288
     {
289
-        return $this->arrConfig[ 'database' ];
289
+        return $this->arrConfig['database'];
290 290
     }
291 291
 
292 292
     /**
293 293
      * @return bool
294 294
      */
295
-    public function hasSchemas ()
295
+    public function hasSchemas()
296 296
     {
297
-        return ! empty ( $this->arrConfig[ 'schema' ] );
297
+        return ! empty ($this->arrConfig['schema']);
298 298
     }
299 299
 
300 300
     /**
301 301
      * @return string[]
302 302
      */
303
-    public function getSchemas ()
303
+    public function getSchemas()
304 304
     {
305
-        if ( is_string ( $this->arrConfig[ 'schema' ] ) )
305
+        if (is_string($this->arrConfig['schema']))
306 306
         {
307
-            return array ( $this->arrConfig[ 'schema' ] );
307
+            return array($this->arrConfig['schema']);
308 308
         }
309 309
 
310
-        return $this->arrConfig[ 'schema' ];
310
+        return $this->arrConfig['schema'];
311 311
     }
312 312
 
313
-    public function setSchema ( $schema )
313
+    public function setSchema($schema)
314 314
     {
315
-        $this->arrConfig[ 'schema' ] = $schema;
315
+        $this->arrConfig['schema'] = $schema;
316 316
     }
317 317
 
318 318
     /**
319 319
      * @return string
320 320
      */
321
-    public function getHost ()
321
+    public function getHost()
322 322
     {
323
-        return $this->arrConfig[ 'host' ];
323
+        return $this->arrConfig['host'];
324 324
     }
325 325
 
326 326
     /**
327 327
      * @return int
328 328
      */
329
-    public function getPort ()
329
+    public function getPort()
330 330
     {
331
-        return $this->arrConfig[ 'port' ];
331
+        return $this->arrConfig['port'];
332 332
     }
333 333
 
334 334
     /**
335 335
      * @return boolean
336 336
      */
337
-    public function hasPort ()
337
+    public function hasPort()
338 338
     {
339
-        return ! empty( $this->arrConfig[ 'port' ] );
339
+        return ! empty($this->arrConfig['port']);
340 340
     }
341 341
 
342 342
     /**
343 343
      * @return string
344 344
      */
345
-    public function getSocket ()
345
+    public function getSocket()
346 346
     {
347
-        return $this->arrConfig[ 'socket' ];
347
+        return $this->arrConfig['socket'];
348 348
     }
349 349
 
350 350
     /**
351 351
      * @return string
352 352
      */
353
-    public function getUser ()
353
+    public function getUser()
354 354
     {
355
-        return $this->arrConfig[ 'username' ];
355
+        return $this->arrConfig['username'];
356 356
     }
357 357
 
358 358
     /**
359 359
      * @return string
360 360
      */
361
-    public function getPassword ()
361
+    public function getPassword()
362 362
     {
363
-        return $this->arrConfig[ 'password' ];
363
+        return $this->arrConfig['password'];
364 364
     }
365 365
 
366 366
     /**
@@ -368,11 +368,11 @@  discard block
 block discarded – undo
368 368
      *
369 369
      * @return string
370 370
      */
371
-    public function replaceReservedWord ( $palavra )
371
+    public function replaceReservedWord($palavra)
372 372
     {
373
-        if ( isset( $this->reservedWord[ strtolower ( $palavra ) ] ) )
373
+        if (isset($this->reservedWord[strtolower($palavra)]))
374 374
         {
375
-            return $this->reservedWord[ strtolower ( $palavra ) ];
375
+            return $this->reservedWord[strtolower($palavra)];
376 376
         }
377 377
 
378 378
         return $palavra;
@@ -381,15 +381,15 @@  discard block
 block discarded – undo
381 381
     /**
382 382
      * @return bool
383 383
      */
384
-    public function isStatusEnabled ()
384
+    public function isStatusEnabled()
385 385
     {
386
-        return (bool) $this->arrConfig[ 'status' ];
386
+        return (bool) $this->arrConfig['status'];
387 387
     }
388 388
 
389
-    public function validTableNames ()
389
+    public function validTableNames()
390 390
     {
391
-        $matches = preg_grep ( '*\.*' , $this->getTablesName () );
392
-        if ( count ( $matches ) )
391
+        $matches = preg_grep('*\.*', $this->getTablesName());
392
+        if (count($matches))
393 393
         {
394 394
            die("error: Table name must not contain the schema\n");
395 395
         }
@@ -398,28 +398,28 @@  discard block
 block discarded – undo
398 398
     /**
399 399
      * @return bool
400 400
      */
401
-    public function hasTablesName (){
402
-        return ! empty( $this->arrConfig[ 'tables' ] );
401
+    public function hasTablesName() {
402
+        return ! empty($this->arrConfig['tables']);
403 403
     }
404 404
 
405 405
     /**
406 406
      * @return string[]
407 407
      */
408
-    public function getTablesName ()
408
+    public function getTablesName()
409 409
     {
410
-        if ( is_string ( $this->arrConfig[ 'tables' ] ) )
410
+        if (is_string($this->arrConfig['tables']))
411 411
         {
412
-            return array ( $this->arrConfig[ 'tables' ] );
412
+            return array($this->arrConfig['tables']);
413 413
         }
414 414
 
415
-        return $this->arrConfig[ 'tables' ];
415
+        return $this->arrConfig['tables'];
416 416
     }
417 417
 
418 418
     /**
419 419
      * @return string
420 420
      */
421
-    public function getListTablesName(){
422
-        $str = implode("','", $this->getTablesName() );
421
+    public function getListTablesName() {
422
+        $str = implode("','", $this->getTablesName());
423 423
         return "'$str'";
424 424
     }
425 425
 
@@ -428,25 +428,25 @@  discard block
 block discarded – undo
428 428
      *
429 429
      * @return string
430 430
      */
431
-    public function __get ( $str )
431
+    public function __get($str)
432 432
     {
433
-        $arr = array (
434
-            'namespace' ,
435
-            'framework' ,
436
-            'author' ,
437
-            'license' ,
438
-            'version' ,
439
-            'copyright' ,
440
-            'link' ,
441
-            'last_modify' ,
442
-            'path' ,
443
-            'folder-database' ,
433
+        $arr = array(
434
+            'namespace',
435
+            'framework',
436
+            'author',
437
+            'license',
438
+            'version',
439
+            'copyright',
440
+            'link',
441
+            'last_modify',
442
+            'path',
443
+            'folder-database',
444 444
             'folder-name'
445 445
         );
446 446
 
447
-        if ( in_array ( $str , $arr ) )
447
+        if (in_array($str, $arr))
448 448
         {
449
-            return $this->arrConfig[ strtolower ( $str ) ];
449
+            return $this->arrConfig[strtolower($str)];
450 450
         }
451 451
 
452 452
         return;
@@ -457,9 +457,9 @@  discard block
 block discarded – undo
457 457
      *
458 458
      * @return string
459 459
      */
460
-    public static function convertTypeToPHP ( $type )
460
+    public static function convertTypeToPHP($type)
461 461
     {
462
-        return self::$dataTypesDefault[ $type ];
462
+        return self::$dataTypesDefault[$type];
463 463
     }
464 464
 
465 465
     /**
@@ -467,8 +467,8 @@  discard block
 block discarded – undo
467 467
      *
468 468
      * @return string
469 469
      */
470
-    public function convertTypeToTypeFramework ( $type )
470
+    public function convertTypeToTypeFramework($type)
471 471
     {
472
-        return $this->dataTypes[ $type ];
472
+        return $this->dataTypes[$type];
473 473
     }
474 474
 }
Please login to merge, or discard this patch.
build/Classes/AdapterMakerFile/ZendFrameworkOne/Entity.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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,39 +44,39 @@  discard block
 block discarded – undo
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
-            $variable = $constrant->getNameConstrant () . ZendFrameworkOne::SEPARETOR . $objColumn->getName ();
62
+            $variable = $constrant->getNameConstrant() . ZendFrameworkOne::SEPARETOR . $objColumn->getName();
63 63
 
64
-            $arrClass = array (
65
-                $makerFile->getConfig ()->createClassNamespace ( $constrant ),
66
-                AbstractMaker::getClassName ( $constrant->getTable () )
64
+            $arrClass = array(
65
+                $makerFile->getConfig()->createClassNamespace($constrant),
66
+                AbstractMaker::getClassName($constrant->getTable())
67 67
             );
68
-            $class = implode ( ZendFrameworkOne::SEPARETOR , array_filter ( $arrClass ) );
69
-
70
-            $parents[] = array (
71
-                'class'    => $class ,
72
-                'function' => AbstractMaker::getClassName ( $name ) ,
73
-                'table'    => $constrant->getTable () ,
74
-                'column'   => $constrant->getColumn() ,
75
-                'name'     => $constrant->getNameConstrant() ,
68
+            $class = implode(ZendFrameworkOne::SEPARETOR, array_filter($arrClass));
69
+
70
+            $parents[] = array(
71
+                'class'    => $class,
72
+                'function' => AbstractMaker::getClassName($name),
73
+                'table'    => $constrant->getTable(),
74
+                'column'   => $constrant->getColumn(),
75
+                'name'     => $constrant->getNameConstrant(),
76 76
                 'variable' => $variable
77 77
 
78 78
             );
79
-            unset( $name );
79
+            unset($name);
80 80
         }
81 81
 
82 82
         return $parents;
@@ -88,43 +88,43 @@  discard block
 block discarded – undo
88 88
      *
89 89
      * @return array
90 90
      */
91
-    private function listDependence ( \Classes\MakerFile $makerFile , \Classes\Db\DbTable $dbTable )
91
+    private function listDependence(\Classes\MakerFile $makerFile, \Classes\Db\DbTable $dbTable)
92 92
     {
93
-        $depends = array ();
94
-        foreach ( $dbTable->getDependences () as $objColumn )
93
+        $depends = array();
94
+        foreach ($dbTable->getDependences() as $objColumn)
95 95
         {
96
-            foreach ( $objColumn->getDependences () as $dependence )
96
+            foreach ($objColumn->getDependences() as $dependence)
97 97
             {
98 98
                 $name =
99 99
                     'Depend'
100 100
                     . ZendFrameworkOne::SEPARETOR
101
-                    . AbstractMaker::getClassName ( $dependence->getTable () )
101
+                    . AbstractMaker::getClassName($dependence->getTable())
102 102
                     . ZendFrameworkOne::SEPARETOR
103 103
                     . 'By'
104 104
                     . ZendFrameworkOne::SEPARETOR
105
-                    . $objColumn->getName ();
105
+                    . $objColumn->getName();
106 106
 
107
-                if ( ! key_exists ( $name , $this->validFunc ) )
107
+                if ( ! key_exists($name, $this->validFunc))
108 108
                 {
109
-                    $variable = $dependence->getNameConstrant () . ZendFrameworkOne::SEPARETOR . $objColumn->getName ();
109
+                    $variable = $dependence->getNameConstrant() . ZendFrameworkOne::SEPARETOR . $objColumn->getName();
110 110
 
111
-                    $arrClass = array (
112
-                        $makerFile->getConfig ()->createClassNamespace ( $dependence ),
113
-                        AbstractMaker::getClassName ( $dependence->getTable () )
111
+                    $arrClass = array(
112
+                        $makerFile->getConfig()->createClassNamespace($dependence),
113
+                        AbstractMaker::getClassName($dependence->getTable())
114 114
                     );
115
-                    $class = implode ( ZendFrameworkOne::SEPARETOR , array_filter ( $arrClass ) );
115
+                    $class = implode(ZendFrameworkOne::SEPARETOR, array_filter($arrClass));
116 116
 
117
-                    $this->validFunc[ $name ] = true;
118
-                    $depends[] = array (
117
+                    $this->validFunc[$name] = true;
118
+                    $depends[] = array(
119 119
                         'class'    =>  $class,
120
-                        'function' => AbstractMaker::getClassName ( $name ) ,
121
-                        'table'    => $dependence->getTable () ,
122
-                        'column'   => $dependence->getColumn () ,
123
-                        'name'     =>  $dependence->getNameConstrant (),
120
+                        'function' => AbstractMaker::getClassName($name),
121
+                        'table'    => $dependence->getTable(),
122
+                        'column'   => $dependence->getColumn(),
123
+                        'name'     =>  $dependence->getNameConstrant(),
124 124
                         'variable' => $variable
125 125
                     );
126 126
                 }
127
-                unset( $name );
127
+                unset($name);
128 128
             }
129 129
         }
130 130
 
Please login to merge, or discard this patch.
build/Classes/AdapterMakerFile/ZendFrameworkOne/DbTable.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -28,68 +28,68 @@
 block discarded – undo
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
         $referenceMap = '';
34
-        $references = array ();
34
+        $references = array();
35 35
         $dependentTables = '';
36
-        $dependents = array ();
37
-        foreach ( $dbTable->getForeingkeys () as $objColumn )
36
+        $dependents = array();
37
+        foreach ($dbTable->getForeingkeys() as $objColumn)
38 38
         {
39
-            $constrant = $objColumn->getFks ();
40
-            $variable =  $constrant->getNameConstrant () . ZendFrameworkOne::SEPARETOR . $objColumn->getName ();
39
+            $constrant = $objColumn->getFks();
40
+            $variable = $constrant->getNameConstrant() . ZendFrameworkOne::SEPARETOR . $objColumn->getName();
41 41
 
42
-            $arrClass = array (
43
-                $makerFile->getConfig ()->createClassNamespace ( $constrant ),
42
+            $arrClass = array(
43
+                $makerFile->getConfig()->createClassNamespace($constrant),
44 44
                 'DbTable',
45
-                AbstractMaker::getClassName ( $constrant->getTable () )
45
+                AbstractMaker::getClassName($constrant->getTable())
46 46
             );
47
-            $class = implode ( ZendFrameworkOne::SEPARETOR , array_filter ( $arrClass ) );
47
+            $class = implode(ZendFrameworkOne::SEPARETOR, array_filter($arrClass));
48 48
 
49
-            $references[] = sprintf (
49
+            $references[] = sprintf(
50 50
                 "
51 51
        '%s' => array (
52 52
             'columns'       => '%s' ,
53 53
             'refTableClass' => '%s',
54 54
             'refColumns'    =>'%s'
55 55
        )",
56
-                AbstractMaker::getClassName ( $variable ),
57
-                $objColumn->getName (),
56
+                AbstractMaker::getClassName($variable),
57
+                $objColumn->getName(),
58 58
                 $class,
59
-                $constrant->getColumn ()
59
+                $constrant->getColumn()
60 60
 
61 61
             );
62 62
         }
63 63
 
64
-        if ( sizeof ( $references ) > 0 )
64
+        if (sizeof($references) > 0)
65 65
         {
66 66
             $referenceMap = "protected \$_referenceMap = array(" .
67
-                join ( ',', $references ) . "\n    );";
67
+                join(',', $references) . "\n    );";
68 68
         }
69 69
 
70
-        foreach ( $dbTable->getDependences () as $objColumn )
70
+        foreach ($dbTable->getDependences() as $objColumn)
71 71
         {
72
-            foreach ( $objColumn->getDependences () as $dependence )
72
+            foreach ($objColumn->getDependences() as $dependence)
73 73
             {
74
-                $arrClass = array (
75
-                    $makerFile->getConfig ()->createClassNamespace ( $dependence ),
74
+                $arrClass = array(
75
+                    $makerFile->getConfig()->createClassNamespace($dependence),
76 76
                     'DbTable',
77
-                    AbstractMaker::getClassName ( $dependence->getTable () )
77
+                    AbstractMaker::getClassName($dependence->getTable())
78 78
                 );
79
-                $class = implode ( ZendFrameworkOne::SEPARETOR , array_filter ( $arrClass ) );
79
+                $class = implode(ZendFrameworkOne::SEPARETOR, array_filter($arrClass));
80 80
 
81 81
                 $dependents[] = $class;
82 82
             }
83 83
         }
84 84
 
85
-        if ( sizeof ( $dependents ) > 0 )
85
+        if (sizeof($dependents) > 0)
86 86
         {
87 87
             $dependentTables = "protected \$_dependentTables = array(\n        '" .
88
-                join ( "',\n        '", $dependents ) . "'\n    );";
88
+                join("',\n        '", $dependents) . "'\n    );";
89 89
         }
90 90
 
91 91
 
92
-        return array (
92
+        return array(
93 93
             'referenceMap'    => $referenceMap,
94 94
             'dependentTables' => $dependentTables
95 95
         );
Please login to merge, or discard this patch.
build/Classes/AdaptersDriver/AbsractAdapter.php 1 patch
Spacing   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     /**
65 65
      * @type \Classes\Db\DbTable[][]
66 66
      */
67
-    private $objDbTables = array ();
67
+    private $objDbTables = array();
68 68
 
69 69
     /**
70 70
      * @var AbstractAdapter
@@ -79,20 +79,20 @@  discard block
 block discarded – undo
79 79
     /**
80 80
      * analisa e popula as Foreing keys, Primary keys e dependencias do banco nos objetos
81 81
      */
82
-    protected function parseConstrants ()
82
+    protected function parseConstrants()
83 83
     {
84
-        foreach ( $this->getListConstrant () as $constrant ) {
85
-
86
-            $schema     = $constrant[ 'table_schema' ];
87
-            $table_name = $constrant [ 'table_name' ];
88
-            $this->populateForeignAndPrimaryKeys ( $constrant, $table_name, $schema );
89
-            unset( $table_name, $schema );
90
-
91
-            if ( $constrant[ 'constraint_type' ] == "FOREIGN KEY" ) {
92
-                $schema     = $constrant[ 'foreign_schema' ];
93
-                $table_name = $constrant [ 'foreign_table' ];
94
-                $this->populateDependece ( $constrant, $table_name, $schema );
95
-                unset( $table_name, $schema );
84
+        foreach ($this->getListConstrant() as $constrant) {
85
+
86
+            $schema     = $constrant['table_schema'];
87
+            $table_name = $constrant ['table_name'];
88
+            $this->populateForeignAndPrimaryKeys($constrant, $table_name, $schema);
89
+            unset($table_name, $schema);
90
+
91
+            if ($constrant['constraint_type'] == "FOREIGN KEY") {
92
+                $schema     = $constrant['foreign_schema'];
93
+                $table_name = $constrant ['foreign_table'];
94
+                $this->populateDependece($constrant, $table_name, $schema);
95
+                unset($table_name, $schema);
96 96
             }
97 97
         }
98 98
     }
@@ -102,34 +102,34 @@  discard block
 block discarded – undo
102 102
      * @param string $table_name
103 103
      * @param int    $schema
104 104
      */
105
-    private function populateForeignAndPrimaryKeys ( $constrant, $table_name, $schema = 0 )
105
+    private function populateForeignAndPrimaryKeys($constrant, $table_name, $schema = 0)
106 106
     {
107
-        if ( $this->hasTable ( $table_name, $schema ) ) {
108
-            $table = $this->getTable ( $table_name, $schema );
109
-            if ( $table->hasColumn ( $constrant[ "column_name" ] ) ) {
110
-                $objConstrant = Constrant::getInstance ()
111
-                                         ->populate (
112
-                                             array (
113
-                                                 'constrant' => $constrant[ 'constraint_name' ],
114
-                                                 'schema'    => $constrant[ 'foreign_schema' ],
115
-                                                 'table'     => $constrant[ 'foreign_table' ],
116
-                                                 'column'    => $constrant[ 'foreign_column' ],
107
+        if ($this->hasTable($table_name, $schema)) {
108
+            $table = $this->getTable($table_name, $schema);
109
+            if ($table->hasColumn($constrant["column_name"])) {
110
+                $objConstrant = Constrant::getInstance()
111
+                                         ->populate(
112
+                                             array(
113
+                                                 'constrant' => $constrant['constraint_name'],
114
+                                                 'schema'    => $constrant['foreign_schema'],
115
+                                                 'table'     => $constrant['foreign_table'],
116
+                                                 'column'    => $constrant['foreign_column'],
117 117
                                                  'database'  => $this->database
118 118
                                              )
119 119
                                          );
120 120
 
121
-                switch ( $constrant[ 'constraint_type' ] ) {
121
+                switch ($constrant['constraint_type']) {
122 122
                     case "FOREIGN KEY":
123
-                        $table->getColumn ( $constrant[ "column_name" ] )
124
-                              ->addRefFk ( $objConstrant );
123
+                        $table->getColumn($constrant["column_name"])
124
+                              ->addRefFk($objConstrant);
125 125
                         break;
126 126
                     case"PRIMARY KEY":
127
-                        $table->getColumn ( $constrant[ "column_name" ] )
128
-                              ->setPrimaryKey ( $objConstrant )
129
-                              ->setSequence (
130
-                                  $this->getSequence (
127
+                        $table->getColumn($constrant["column_name"])
128
+                              ->setPrimaryKey($objConstrant)
129
+                              ->setSequence(
130
+                                  $this->getSequence(
131 131
                                       $table_name,
132
-                                      $constrant[ "column_name" ],
132
+                                      $constrant["column_name"],
133 133
                                       $schema
134 134
                                   )
135 135
                               );
@@ -144,18 +144,18 @@  discard block
 block discarded – undo
144 144
      * @param string $table_name
145 145
      * @param int    $schema
146 146
      */
147
-    private function populateDependece ( $constrant, $table_name, $schema = 0 )
147
+    private function populateDependece($constrant, $table_name, $schema = 0)
148 148
     {
149
-        if ( $this->hasTable ( $table_name, $schema ) ) {
150
-            $table = $this->getTable ( $table_name, $schema );
151
-            if ( $table->hasColumn ( $constrant[ "foreign_column" ] ) ) {
152
-                $table->getColumn ( $constrant[ "foreign_column" ] )
153
-                      ->createDependece (
154
-                          $constrant[ 'constraint_name' ],
155
-                          $constrant[ 'table_name' ],
156
-                          $constrant[ 'column_name' ],
149
+        if ($this->hasTable($table_name, $schema)) {
150
+            $table = $this->getTable($table_name, $schema);
151
+            if ($table->hasColumn($constrant["foreign_column"])) {
152
+                $table->getColumn($constrant["foreign_column"])
153
+                      ->createDependece(
154
+                          $constrant['constraint_name'],
155
+                          $constrant['table_name'],
156
+                          $constrant['column_name'],
157 157
                           $this->database,
158
-                          $constrant[ 'table_schema' ]
158
+                          $constrant['table_schema']
159 159
                       );
160 160
             }
161 161
         }
@@ -164,33 +164,33 @@  discard block
 block discarded – undo
164 164
     /**
165 165
      * cria um Array com nome das tabelas
166 166
      */
167
-    public function parseTables ()
167
+    public function parseTables()
168 168
     {
169
-        if ( $this->hasTables () ) {
170
-            return $this->getAllTables ();
169
+        if ($this->hasTables()) {
170
+            return $this->getAllTables();
171 171
         }
172 172
 
173
-        foreach ( $this->getListColumns () as $table ) {
174
-            $schema = $table[ 'table_schema' ];
175
-            $key    = $table [ 'table_name' ];
176
-            if ( !$this->hasTable ( $key, $schema ) ) {
177
-                $this->createTable ( $key, $schema );
173
+        foreach ($this->getListColumns() as $table) {
174
+            $schema = $table['table_schema'];
175
+            $key    = $table ['table_name'];
176
+            if ( ! $this->hasTable($key, $schema)) {
177
+                $this->createTable($key, $schema);
178 178
             }
179 179
 
180
-            $column = Column::getInstance ()
181
-                            ->populate (
182
-                                array (
183
-                                    'name'       => $table [ 'column_name' ],
184
-                                    'type'       => $this->convertTypeToSimple ( $table[ 'data_type' ] ),
185
-                                    'nullable'   => ( $table[ 'is_nullable' ] == 'YES' ),
186
-                                    'max_length' => $table[ 'max_length' ]
180
+            $column = Column::getInstance()
181
+                            ->populate(
182
+                                array(
183
+                                    'name'       => $table ['column_name'],
184
+                                    'type'       => $this->convertTypeToSimple($table['data_type']),
185
+                                    'nullable'   => ($table['is_nullable'] == 'YES'),
186
+                                    'max_length' => $table['max_length']
187 187
                                 )
188 188
                             );
189 189
 
190
-            $this->getTable ( $key, $schema )
191
-                 ->addColumn ( $column )
192
-                 ->setNamespace (
193
-                     $this->config->createClassNamespace ( $this->getTable ( $key, $schema ) )
190
+            $this->getTable($key, $schema)
191
+                 ->addColumn($column)
192
+                 ->setNamespace(
193
+                     $this->config->createClassNamespace($this->getTable($key, $schema))
194 194
                  );
195 195
         }
196 196
     }
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
      *
201 201
      * @return int
202 202
      */
203
-    abstract public function getTotalTables ();
203
+    abstract public function getTotalTables();
204 204
 
205 205
     /**
206 206
      * Retorna o Nome da Sequence da tabela
@@ -210,31 +210,31 @@  discard block
 block discarded – undo
210 210
      *
211 211
      * @return string
212 212
      */
213
-    abstract public function getSequence ( $table, $column, $schema = 0 );
213
+    abstract public function getSequence($table, $column, $schema = 0);
214 214
 
215 215
     /**
216 216
      * @return array
217 217
      */
218
-    abstract public function getListConstrant ();
218
+    abstract public function getListConstrant();
219 219
 
220 220
     /**
221 221
      * @param string $str
222 222
      *
223 223
      * @return string
224 224
      */
225
-    protected function convertTypeToPhp ( $str )
225
+    protected function convertTypeToPhp($str)
226 226
     {
227
-        if ( isset( $this->dataTypesToPhp[ $str ] ) ) {
228
-            return $this->dataTypesToPhp[ $str ];
227
+        if (isset($this->dataTypesToPhp[$str])) {
228
+            return $this->dataTypesToPhp[$str];
229 229
         }
230 230
 
231 231
         return 'string';
232 232
     }
233 233
 
234
-    protected function convertTypeToSimple ( $str )
234
+    protected function convertTypeToSimple($str)
235 235
     {
236
-        if ( isset( $this->dataTypesToSimple[ $str ] ) ) {
237
-            return $this->dataTypesToSimple[ $str ];
236
+        if (isset($this->dataTypesToSimple[$str])) {
237
+            return $this->dataTypesToSimple[$str];
238 238
         }
239 239
 
240 240
         return 'string';
@@ -243,12 +243,12 @@  discard block
 block discarded – undo
243 243
     /**
244 244
      * @return string
245 245
      */
246
-    abstract public function getPDOString ();
246
+    abstract public function getPDOString();
247 247
 
248 248
     /**
249 249
      * @return string
250 250
      */
251
-    abstract public function getPDOSocketString ();
251
+    abstract public function getPDOSocketString();
252 252
 
253 253
     /**
254 254
      * @param     $nameTable
@@ -256,11 +256,11 @@  discard block
 block discarded – undo
256 256
      *
257 257
      * @return \Classes\Db\DbTable
258 258
      */
259
-    public function createTable ( $nameTable, $schema = 0 )
259
+    public function createTable($nameTable, $schema = 0)
260 260
     {
261
-        $this->objDbTables[ $schema ][ trim ( $nameTable ) ] = DbTable::getInstance ()
262
-                                                                      ->populate (
263
-                                                                          array (
261
+        $this->objDbTables[$schema][trim($nameTable)] = DbTable::getInstance()
262
+                                                                      ->populate(
263
+                                                                          array(
264 264
                                                                               'table'    => $nameTable,
265 265
                                                                               'schema'   => $schema,
266 266
                                                                               'database' => $this->database
@@ -275,23 +275,23 @@  discard block
 block discarded – undo
275 275
      *
276 276
      * @return \Classes\Db\DbTable[]
277 277
      */
278
-    public function getTables ( $schema = 0 )
278
+    public function getTables($schema = 0)
279 279
     {
280
-        if ( !isset( $this->objDbTables[ $schema ] ) ) {
281
-            return array ();
280
+        if ( ! isset($this->objDbTables[$schema])) {
281
+            return array();
282 282
         }
283 283
 
284
-        return $this->objDbTables[ $schema ];
284
+        return $this->objDbTables[$schema];
285 285
     }
286 286
 
287
-    public function getAllTables ()
287
+    public function getAllTables()
288 288
     {
289 289
         return $this->objDbTables;
290 290
     }
291 291
 
292
-    public function hasTables ()
292
+    public function hasTables()
293 293
     {
294
-        return !empty( $this->objDbTables );
294
+        return ! empty($this->objDbTables);
295 295
     }
296 296
 
297 297
     /**
@@ -301,9 +301,9 @@  discard block
 block discarded – undo
301 301
      *
302 302
      * @return \Classes\Db\DbTable
303 303
      */
304
-    public function getTable ( $nameTable, $schema = 0 )
304
+    public function getTable($nameTable, $schema = 0)
305 305
     {
306
-        return $this->objDbTables[ $schema ][ trim ( $nameTable ) ];
306
+        return $this->objDbTables[$schema][trim($nameTable)];
307 307
     }
308 308
 
309 309
     /**
@@ -312,9 +312,9 @@  discard block
 block discarded – undo
312 312
      *
313 313
      * @return bool
314 314
      */
315
-    public function hasTable ( $nameTable, $schema = 0 )
315
+    public function hasTable($nameTable, $schema = 0)
316 316
     {
317
-        return isset( $this->objDbTables[ $schema ][ trim ( $nameTable ) ] );
317
+        return isset($this->objDbTables[$schema][trim($nameTable)]);
318 318
     }
319 319
 
320 320
     /**
@@ -322,60 +322,60 @@  discard block
 block discarded – undo
322 322
      *
323 323
      * @return array[]
324 324
      */
325
-    abstract public function getListColumns ();
325
+    abstract public function getListColumns();
326 326
 
327 327
     /**
328 328
      * Retorna um Array com nome das tabelas
329 329
      *
330 330
      * @return string[]
331 331
      */
332
-    abstract public function getListNameTable ();
332
+    abstract public function getListNameTable();
333 333
 
334 334
     /**
335 335
      * @param \Classes\AdapterConfig\AbstractAdapter $adapterConfig
336 336
      */
337
-    public function __construct ( AbstractAdapter $adapterConfig )
337
+    public function __construct(AbstractAdapter $adapterConfig)
338 338
     {
339 339
         $this->config   = $adapterConfig;
340
-        $this->host     = $adapterConfig->getHost ();
341
-        $this->database = $adapterConfig->getDatabase ();
342
-        $this->port     = $adapterConfig->hasPort () ? $adapterConfig->getPort () : $this->port;
343
-        $this->username = $adapterConfig->getUser ();
344
-        $this->password = $adapterConfig->getPassword ();
345
-        $this->socket   = $adapterConfig->getSocket ();
346
-        $this->tablesName = $adapterConfig->hasTablesName ()? $adapterConfig->getListTablesName():'';
340
+        $this->host     = $adapterConfig->getHost();
341
+        $this->database = $adapterConfig->getDatabase();
342
+        $this->port     = $adapterConfig->hasPort() ? $adapterConfig->getPort() : $this->port;
343
+        $this->username = $adapterConfig->getUser();
344
+        $this->password = $adapterConfig->getPassword();
345
+        $this->socket   = $adapterConfig->getSocket();
346
+        $this->tablesName = $adapterConfig->hasTablesName() ? $adapterConfig->getListTablesName() : '';
347 347
 
348 348
     }
349 349
 
350 350
     /**
351 351
      * Executa as consultas do banco de dados
352 352
      */
353
-    public function runDatabase ()
353
+    public function runDatabase()
354 354
     {
355
-        $this->parseTables ();
356
-        $this->parseConstrants ();
355
+        $this->parseTables();
356
+        $this->parseConstrants();
357 357
     }
358 358
 
359 359
     /**
360 360
      *
361 361
      * @return \PDO
362 362
      */
363
-    public function getPDO ()
363
+    public function getPDO()
364 364
     {
365
-        if ( is_null ( $this->_pdo ) ) {
366
-            if ( !empty( $this->socket ) ) {
367
-                $pdoString = $this->getPDOSocketString ();
365
+        if (is_null($this->_pdo)) {
366
+            if ( ! empty($this->socket)) {
367
+                $pdoString = $this->getPDOSocketString();
368 368
             }
369 369
             else {
370
-                $pdoString = $this->getPDOString ();
370
+                $pdoString = $this->getPDOString();
371 371
             }
372 372
 
373 373
             try {
374
-                $this->_pdo = new \PDO (
374
+                $this->_pdo = new \PDO(
375 375
                     $pdoString, $this->username, $this->password
376 376
                 );
377
-            } catch ( \Exception $e ) {
378
-                die ( "pdo error: " . $e->getMessage () . "\n" );
377
+            } catch (\Exception $e) {
378
+                die ("pdo error: " . $e->getMessage() . "\n");
379 379
             }
380 380
         }
381 381
 
Please login to merge, or discard this patch.
build/Classes/AdaptersDriver/Pgsql.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
     /**
28 28
      * @type array|\string[]
29 29
      */
30
-    protected $schema = array ( 'public' );
30
+    protected $schema = array('public');
31 31
 
32
-    protected $dataTypesToSimple = array (
32
+    protected $dataTypesToSimple = array(
33 33
         /* Numeric Types */
34 34
         'smallint'         => 'int',
35 35
         'integer'          => 'int',
@@ -57,11 +57,11 @@  discard block
 block discarded – undo
57 57
         'boolean'          => 'boolean'
58 58
     );
59 59
 
60
-    public function __construct ( AbstractAdapter $adapterConfig )
60
+    public function __construct(AbstractAdapter $adapterConfig)
61 61
     {
62
-        parent::__construct ( $adapterConfig );
63
-        if ( $adapterConfig->hasSchemas () ) {
64
-            $this->schema = $adapterConfig->getSchemas ();
62
+        parent::__construct($adapterConfig);
63
+        if ($adapterConfig->hasSchemas()) {
64
+            $this->schema = $adapterConfig->getSchemas();
65 65
         }
66 66
 
67 67
     }
@@ -73,16 +73,16 @@  discard block
 block discarded – undo
73 73
      *
74 74
      * @return string[]
75 75
      */
76
-    public function getListNameTable ()
76
+    public function getListNameTable()
77 77
     {
78
-        if ( empty( $this->tableList ) ) {
78
+        if (empty($this->tableList)) {
79 79
 
80
-            $sqlTables = !empty($this->tablesName)?"AND table_name IN ( $this->tablesName )":'';
80
+            $sqlTables = ! empty($this->tablesName) ? "AND table_name IN ( $this->tablesName )" : '';
81 81
 
82
-            $strSchema = implode ( "', '", $this->schema );
82
+            $strSchema = implode("', '", $this->schema);
83 83
 
84
-            $this->tableList = $this->getPDO ()
85
-                                    ->query (
84
+            $this->tableList = $this->getPDO()
85
+                                    ->query(
86 86
                                         "SELECT table_schema,
87 87
               table_name
88 88
              FROM information_schema.tables
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
                table_name
95 95
               ASC"
96 96
                                     )
97
-                                    ->fetchAll ();
97
+                                    ->fetchAll();
98 98
         }
99 99
 
100 100
         return $this->tableList;
@@ -105,13 +105,13 @@  discard block
 block discarded – undo
105 105
      *
106 106
      * @return array
107 107
      */
108
-    public function getListColumns ()
108
+    public function getListColumns()
109 109
     {
110
-        $sqlTables = !empty($this->tablesName)?"AND c.table_name IN ( $this->tablesName )":'';
111
-        $strSchema = implode ( "', '", $this->schema );
110
+        $sqlTables = ! empty($this->tablesName) ? "AND c.table_name IN ( $this->tablesName )" : '';
111
+        $strSchema = implode("', '", $this->schema);
112 112
 
113
-        return $this->getPDO ()
114
-                    ->query (
113
+        return $this->getPDO()
114
+                    ->query(
115 115
                         "SELECT distinct
116 116
 	c.table_schema,
117 117
 	c.table_name,
@@ -126,16 +126,16 @@  discard block
 block discarded – undo
126 126
 		 $sqlTables and  c.table_schema IN ('$strSchema')
127 127
 		order by c.table_name asc"
128 128
                     )
129
-                    ->fetchAll ( \PDO::FETCH_ASSOC );
129
+                    ->fetchAll(\PDO::FETCH_ASSOC);
130 130
     }
131 131
 
132
-    public function getListConstrant ()
132
+    public function getListConstrant()
133 133
     {
134
-        $sqlTables = !empty($this->tablesName)?"AND tc.table_name IN ( $this->tablesName )":'';
135
-        $strSchema = implode ( "', '", $this->schema );
134
+        $sqlTables = ! empty($this->tablesName) ? "AND tc.table_name IN ( $this->tablesName )" : '';
135
+        $strSchema = implode("', '", $this->schema);
136 136
 
137
-        return $this->getPDO ()
138
-                    ->query (
137
+        return $this->getPDO()
138
+                    ->query(
139 139
                         "SELECT distinct
140 140
                 tc.constraint_type,
141 141
                 tc.constraint_name,
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
                         AND tc.constraint_schema = ccu.constraint_schema
158 158
                     ORDER by tc.table_schema"
159 159
                     )
160
-                    ->fetchAll ( \PDO::FETCH_ASSOC );
160
+                    ->fetchAll(\PDO::FETCH_ASSOC);
161 161
     }
162 162
 
163 163
     /**
@@ -168,22 +168,22 @@  discard block
 block discarded – undo
168 168
      *
169 169
      * @return string
170 170
      */
171
-    public function getSequence ( $table, $column, $schema = 0 )
171
+    public function getSequence($table, $column, $schema = 0)
172 172
     {
173 173
         $tableTemp = $table;
174
-        if ( 0 !== $schema ) {
174
+        if (0 !== $schema) {
175 175
             $tableTemp = $schema . '.' . $table;
176 176
         }
177 177
 
178
-        $pdo     = $this->getPDO ();
179
-        $return1 = $pdo->query ( "SELECT pg_get_serial_sequence('$tableTemp', '$column');" )
180
-                       ->fetchColumn ();
178
+        $pdo     = $this->getPDO();
179
+        $return1 = $pdo->query("SELECT pg_get_serial_sequence('$tableTemp', '$column');")
180
+                       ->fetchColumn();
181 181
 
182
-        if ( !is_null ( $return1 ) ) {
182
+        if ( ! is_null($return1)) {
183 183
             return $return1;
184 184
         }
185 185
 
186
-        $stmt = $pdo->prepare (
186
+        $stmt = $pdo->prepare(
187 187
             "SELECT distinct adsrc FROM pg_attrdef AS att
188 188
             INNER JOIN pg_class AS c
189 189
               ON adrelid = c.oid AND c.relname = ? --table
@@ -194,15 +194,15 @@  discard block
 block discarded – undo
194 194
               "
195 195
         );
196 196
 
197
-        $stmt->bindParam ( 1, $table );
198
-        $stmt->bindParam ( 2, $column );
199
-        $stmt->bindParam ( 3, $schema );
200
-        $stmt->execute ();
201
-        $return2 = $stmt->fetchColumn ();
197
+        $stmt->bindParam(1, $table);
198
+        $stmt->bindParam(2, $column);
199
+        $stmt->bindParam(3, $schema);
200
+        $stmt->execute();
201
+        $return2 = $stmt->fetchColumn();
202 202
 
203
-        if ( $return2 ) {
204
-            return preg_filter (
205
-                array (
203
+        if ($return2) {
204
+            return preg_filter(
205
+                array(
206 206
                     '/nextval\(\'/',
207 207
                     '/\'::regclass\)/'
208 208
                 ),
@@ -217,9 +217,9 @@  discard block
 block discarded – undo
217 217
      * @inheritDoc
218 218
      * @return string
219 219
      */
220
-    public function getPDOString ()
220
+    public function getPDOString()
221 221
     {
222
-        return sprintf (
222
+        return sprintf(
223 223
             "pgsql:host=%s;port=%s;dbname=%s",
224 224
             $this->host,
225 225
             $this->port,
@@ -232,9 +232,9 @@  discard block
 block discarded – undo
232 232
      * @inheritDoc
233 233
      * @return string
234 234
      */
235
-    public function getPDOSocketString ()
235
+    public function getPDOSocketString()
236 236
     {
237
-        return sprintf (
237
+        return sprintf(
238 238
             "pgsql:unix_socket=%s;dbname=%s",
239 239
             $this->socket,
240 240
             $this->database
@@ -247,22 +247,22 @@  discard block
 block discarded – undo
247 247
      *
248 248
      * @return int
249 249
      */
250
-    public function getTotalTables ()
250
+    public function getTotalTables()
251 251
     {
252
-        if ( empty( $this->totalTables ) ) {
253
-            $sqlTables = !empty($this->tablesName)?"AND table_name IN ( $this->tablesName )":'';
252
+        if (empty($this->totalTables)) {
253
+            $sqlTables = ! empty($this->tablesName) ? "AND table_name IN ( $this->tablesName )" : '';
254 254
 
255
-            $strSchema = implode ( "', '", $this->schema );
255
+            $strSchema = implode("', '", $this->schema);
256 256
 
257
-            $this->totalTables = $this->getPDO ()
258
-                                      ->query (
257
+            $this->totalTables = $this->getPDO()
258
+                                      ->query(
259 259
                                           "SELECT COUNT(table_name)  AS total
260 260
              FROM information_schema.tables
261 261
              WHERE
262 262
               table_type = 'BASE TABLE'
263 263
               AND table_schema IN ( '" . $strSchema . "' ) $sqlTables"
264 264
                                       )
265
-                                      ->fetchColumn ();
265
+                                      ->fetchColumn();
266 266
         }
267 267
 
268 268
         return (int) $this->totalTables;
Please login to merge, or discard this patch.
build/Classes/AdaptersDriver/Mysql.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -174,10 +174,10 @@  discard block
 block discarded – undo
174 174
             $sqlTables = !empty($this->tablesName)?"AND table_name IN ( $this->tablesName )":'';
175 175
 
176 176
             $this->totalTables = $this->getPDO ()
177
-                                      ->query (
178
-                                          "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = '{$this->database}' $sqlTables"
179
-                                      )
180
-                                      ->fetchColumn ();
177
+                                        ->query (
178
+                                            "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = '{$this->database}' $sqlTables"
179
+                                        )
180
+                                        ->fetchColumn ();
181 181
         }
182 182
 
183 183
         return (int) $this->totalTables;
@@ -194,10 +194,10 @@  discard block
 block discarded – undo
194 194
     public function getSequence ( $table, $column, $schema = 0 )
195 195
     {
196 196
         $return = $this->getPDO ()
197
-                       ->query (
198
-                           "select * from information_schema.columns where extra like '%auto_increment%' and  TABLE_SCHEMA='{$this->database}' AND TABLE_NAME='{$table}' AND COLUMN_NAME='{$column}';"
199
-                       )
200
-                       ->fetch ( \PDO::FETCH_ASSOC );
197
+                        ->query (
198
+                            "select * from information_schema.columns where extra like '%auto_increment%' and  TABLE_SCHEMA='{$this->database}' AND TABLE_NAME='{$table}' AND COLUMN_NAME='{$column}';"
199
+                        )
200
+                        ->fetch ( \PDO::FETCH_ASSOC );
201 201
 
202 202
         if ( !$return ) {
203 203
             return;
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -30,28 +30,28 @@  discard block
 block discarded – undo
30 30
      *
31 31
      * @return string
32 32
      */
33
-    protected function convertTypeToSimple ( $str )
33
+    protected function convertTypeToSimple($str)
34 34
     {
35 35
         $res = '';
36
-        if ( preg_match ( '/(tinyint\(1\)|bit)/', $str ) ) {
36
+        if (preg_match('/(tinyint\(1\)|bit)/', $str)) {
37 37
             $res = 'boolean';
38 38
         }
39
-        elseif ( preg_match ( '/(timestamp|blob|char|enum)/', $str ) ) {
39
+        elseif (preg_match('/(timestamp|blob|char|enum)/', $str)) {
40 40
             $res = 'string';
41 41
         }
42
-        elseif ( preg_match ( '/(text)/', $str ) ) {
42
+        elseif (preg_match('/(text)/', $str)) {
43 43
             $res = 'text';
44 44
         }
45
-        elseif ( preg_match ( '/(decimal|numeric|float|double)/', $str ) ) {
45
+        elseif (preg_match('/(decimal|numeric|float|double)/', $str)) {
46 46
             $res = 'float';
47 47
         }
48
-        elseif ( preg_match ( '#^(?:tiny|small|medium|long|big|var)?(\w+)(?:\(\d+\))?(?:\s\w+)*$#', $str, $matches ) ) {
49
-            $res = $matches[ 1 ];
48
+        elseif (preg_match('#^(?:tiny|small|medium|long|big|var)?(\w+)(?:\(\d+\))?(?:\s\w+)*$#', $str, $matches)) {
49
+            $res = $matches[1];
50 50
         }
51
-        elseif ( preg_match ( '/(date)/', $str ) ) {
51
+        elseif (preg_match('/(date)/', $str)) {
52 52
             $res = 'date';
53 53
         }
54
-        elseif ( preg_match ( '/(datetime)/', $str ) ) {
54
+        elseif (preg_match('/(datetime)/', $str)) {
55 55
             $res = 'datetime';
56 56
         }
57 57
         else {
@@ -65,9 +65,9 @@  discard block
 block discarded – undo
65 65
      * @inheritDoc
66 66
      * @return string
67 67
      */
68
-    public function getPDOString ()
68
+    public function getPDOString()
69 69
     {
70
-        return sprintf (
70
+        return sprintf(
71 71
             "mysql:host=%s;port=%s;dbname=%s",
72 72
             $this->host,
73 73
             $this->port,
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
      * @inheritDoc
81 81
      * @return string
82 82
      */
83
-    public function getPDOSocketString ()
83
+    public function getPDOSocketString()
84 84
     {
85
-        return sprintf (
85
+        return sprintf(
86 86
             "mysql:unix_socket=%s;dbname=%s",
87 87
             $this->socket,
88 88
             $this->database
@@ -94,14 +94,14 @@  discard block
 block discarded – undo
94 94
      * @inheritDoc
95 95
      * @return string[]
96 96
      */
97
-    public function getListNameTable ()
97
+    public function getListNameTable()
98 98
     {
99
-        if ( empty( $this->tableList ) ) {
100
-            $this->tableList = $this->getPDO ()
101
-                                    ->query (
99
+        if (empty($this->tableList)) {
100
+            $this->tableList = $this->getPDO()
101
+                                    ->query(
102 102
                                         "show tables"
103 103
                                     )
104
-                                    ->fetchAll ();
104
+                                    ->fetchAll();
105 105
         }
106 106
 
107 107
         return $this->tableList;
@@ -112,12 +112,12 @@  discard block
 block discarded – undo
112 112
      *
113 113
      * @return array[]
114 114
      */
115
-    public function getListColumns ()
115
+    public function getListColumns()
116 116
     {
117
-        $sqlTables = !empty($this->tablesName)?"AND table_name IN ( $this->tablesName )":'';
117
+        $sqlTables = ! empty($this->tablesName) ? "AND table_name IN ( $this->tablesName )" : '';
118 118
 
119
-        return $this->getPDO ()
120
-                    ->query (
119
+        return $this->getPDO()
120
+                    ->query(
121 121
                         "select
122 122
                 0 AS table_schema,
123 123
                 table_name,
@@ -129,18 +129,18 @@  discard block
 block discarded – undo
129 129
             where table_schema IN ('{$this->database}') $sqlTables
130 130
             order by table_name,ordinal_position"
131 131
                     )
132
-                    ->fetchAll ( \PDO::FETCH_ASSOC );
132
+                    ->fetchAll(\PDO::FETCH_ASSOC);
133 133
     }
134 134
 
135 135
     /**
136 136
      * @return array
137 137
      */
138
-    public function getListConstrant ()
138
+    public function getListConstrant()
139 139
     {
140
-        $sqlTables = !empty($this->tablesName)?"AND k.table_name IN ( $this->tablesName )":'';
140
+        $sqlTables = ! empty($this->tablesName) ? "AND k.table_name IN ( $this->tablesName )" : '';
141 141
 
142
-        return $this->getPDO ()
143
-                    ->query (
142
+        return $this->getPDO()
143
+                    ->query(
144 144
                         "SELECT distinct
145 145
      i.constraint_type,
146 146
      k.constraint_name,
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 i.TABLE_SCHEMA IN ('{$this->database}') AND i.CONSTRAINT_TYPE IN ('FOREIGN KEY', 'PRIMARY KEY' ) $sqlTables
160 160
 order by k.table_schema, k.table_name;"
161 161
                     )
162
-                    ->fetchAll ( \PDO::FETCH_ASSOC );
162
+                    ->fetchAll(\PDO::FETCH_ASSOC);
163 163
     }
164 164
 
165 165
     /**
@@ -167,17 +167,17 @@  discard block
 block discarded – undo
167 167
      *
168 168
      * @return int
169 169
      */
170
-    public function getTotalTables ()
170
+    public function getTotalTables()
171 171
     {
172
-        if ( empty( $this->totalTables ) ) {
172
+        if (empty($this->totalTables)) {
173 173
 
174
-            $sqlTables = !empty($this->tablesName)?"AND table_name IN ( $this->tablesName )":'';
174
+            $sqlTables = ! empty($this->tablesName) ? "AND table_name IN ( $this->tablesName )" : '';
175 175
 
176
-            $this->totalTables = $this->getPDO ()
177
-                                      ->query (
176
+            $this->totalTables = $this->getPDO()
177
+                                      ->query(
178 178
                                           "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = '{$this->database}' $sqlTables"
179 179
                                       )
180
-                                      ->fetchColumn ();
180
+                                      ->fetchColumn();
181 181
         }
182 182
 
183 183
         return (int) $this->totalTables;
@@ -191,15 +191,15 @@  discard block
 block discarded – undo
191 191
      *
192 192
      * @return string
193 193
      */
194
-    public function getSequence ( $table, $column, $schema = 0 )
194
+    public function getSequence($table, $column, $schema = 0)
195 195
     {
196
-        $return = $this->getPDO ()
197
-                       ->query (
196
+        $return = $this->getPDO()
197
+                       ->query(
198 198
                            "select * from information_schema.columns where extra like '%auto_increment%' and  TABLE_SCHEMA='{$this->database}' AND TABLE_NAME='{$table}' AND COLUMN_NAME='{$column}';"
199 199
                        )
200
-                       ->fetch ( \PDO::FETCH_ASSOC );
200
+                       ->fetch(\PDO::FETCH_ASSOC);
201 201
 
202
-        if ( !$return ) {
202
+        if ( ! $return) {
203 203
             return;
204 204
         }
205 205
 
Please login to merge, or discard this patch.
build/Classes/templates/zf1/model.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -3,20 +3,20 @@
 block discarded – undo
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
- * @package <?=$objTables->getNamespace()."\n"?>
9
- * @see  <?=$objTables->getNamespace()?>_Entity_<?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () )?>. <?="\n"?>
8
+ * @package <?=$objTables->getNamespace() . "\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"?>
16
- * @version   <?=$this->config->version."\n"?>
13
+ * @copyright <?=$this->config->copyright . "\n"?>
14
+ * @license   <?=$this->config->license . "\n"?>
15
+ * @link      <?=$this->config->link . "\n"?>
16
+ * @version   <?=$this->config->version . "\n"?>
17 17
  */
18 18
 
19
-class <?=$objTables->getNamespace()?>_<?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () )?> extends <?=$objTables->getNamespace()?>_Entity_<?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () ). "\n"?>
19
+class <?=$objTables->getNamespace()?>_<?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName())?> extends <?=$objTables->getNamespace()?>_Entity_<?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName()) . "\n"?>
20 20
 {
21 21
        /* @TODO Codifique aqui */
22 22
 }
Please login to merge, or discard this patch.