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
Push — master ( eff067...0eaf5e )
by Pedro
03:29 queued 23s
created
build/Classes/templates/zf1/dbtable.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -3,20 +3,20 @@  discard block
 block discarded – undo
3 3
 /**
4 4
  * Application Model DbTables
5 5
  *
6
- * <?=$this->config->last_modify."\n"?>
6
+ * <?=$this->config->last_modify . "\n"?>
7 7
  *
8 8
  * Tabela definida por 'tablename'
9 9
  *
10 10
  * @package   <?=$objTables->getNamespace()?><?="\n"?>
11 11
  * @subpackage DbTable
12
- * @author    <?=$this->config->author."\n"?>
12
+ * @author    <?=$this->config->author . "\n"?>
13 13
  *
14
- * @copyright <?=$this->config->copyright."\n"?>
15
- * @license   <?=$this->config->license."\n"?>
16
- * @link      <?=$this->config->link."\n"?>
14
+ * @copyright <?=$this->config->copyright . "\n"?>
15
+ * @license   <?=$this->config->license . "\n"?>
16
+ * @link      <?=$this->config->link . "\n"?>
17 17
  */
18 18
 
19
-class <?=$objTables->getNamespace()?>_DbTable_<?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () )?> extends <?=$this->config->namespace?>Model_<?=$objMakeFile->getParentClass() . "\n"?>
19
+class <?=$objTables->getNamespace()?>_DbTable_<?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName())?> extends <?=$this->config->namespace?>Model_<?=$objMakeFile->getParentClass() . "\n"?>
20 20
 {
21 21
     /**
22 22
      * Nome da tabela do banco de dados
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      * @access protected
26 26
      */
27 27
     protected $_name = '<?=$objTables->getName()?>';
28
-<?php if($objTables->hasSchema()): ?>
28
+<?php if ($objTables->hasSchema()): ?>
29 29
 
30 30
     /**
31 31
      * Schema da tabela do banco de dados
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
      * @var string
43 43
      * @access protected
44 44
      */
45
-    protected $_rowClass = '<?=$objTables->getNamespace()?>_<?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () )?>';
45
+    protected $_rowClass = '<?=$objTables->getNamespace()?>_<?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName())?>';
46 46
 
47
-<?php if( $objTables->hasPrimaryKey() ):?>
47
+<?php if ($objTables->hasPrimaryKey()):?>
48 48
 	/**
49 49
      * Nome da Primary Key
50 50
      *
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
      * @access protected
53 53
      */
54 54
     protected $_primary = array(
55
-<?php foreach($objTables->getPrimaryKeys() as $pks):?>
55
+<?php foreach ($objTables->getPrimaryKeys() as $pks):?>
56 56
         '<?=$pks->getName()?>',
57 57
 <?php endforeach; ?>
58 58
     );
59 59
 <?php endif ?>
60
-<?php if($this->config->{'folder-name'}):?>
60
+<?php if ($this->config->{'folder-name'}):?>
61 61
     /**
62 62
     * Initialize database adapter.
63 63
     *
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
         parent::_setupDatabaseAdapter();
73 73
     }
74 74
 <?php endif ?>
75
-<?php if( $objTables->hasSequences() ) : ?>
75
+<?php if ($objTables->hasSequences()) : ?>
76 76
 
77 77
 	/**
78 78
      * Definir a lógica para os novos valores na chave primária.
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
      *
81 81
      * @var mixed
82 82
      */
83
-<?php if ( 1 ==  count($objTables->getSequences() ) ) : ?>
84
-<?php if(strpos($this->config->driver, 'pgsql')): ?>
85
-<?php $seqs = $objTables->getSequences();reset($seqs);$seq = current($seqs);?>
83
+<?php if (1 == count($objTables->getSequences())) : ?>
84
+<?php if (strpos($this->config->driver, 'pgsql')): ?>
85
+<?php $seqs = $objTables->getSequences(); reset($seqs); $seq = current($seqs); ?>
86 86
     protected $_sequence = '<?=$seq->getSequence() ?>';
87 87
 <?php else: ?>
88 88
     protected $_sequence = true;
Please login to merge, or discard this patch.
build/Classes/AdapterConfig/AbstractAdapter.php 1 patch
Spacing   +123 added lines, -123 removed lines patch added patch discarded remove patch
@@ -14,42 +14,42 @@  discard block
 block discarded – undo
14 14
 abstract class AbstractAdapter
15 15
 {
16 16
 
17
-    protected $arrConfig = array (
17
+    protected $arrConfig = array(
18 18
         ############################# DATABASE
19 19
         //Driver do banco de dados
20
-        'driver'   => null ,
20
+        'driver'   => null,
21 21
         //Nome do banco de dados
22
-        'database' => null ,
22
+        'database' => null,
23 23
         //Host do banco
24
-        'host'     => 'localhost' ,
24
+        'host'     => 'localhost',
25 25
         //Port do banco
26
-        'port'     => '' ,
26
+        'port'     => '',
27 27
         //usuario do banco
28
-        'username' => null ,
28
+        'username' => null,
29 29
         //senha do banco
30
-        'password' => null ,
30
+        'password' => null,
31 31
         // lista de schemas do banco de dados
32
-        'schema'   => array () ,
32
+        'schema'   => array(),
33 33
 
34
-        'socket'          => null ,
34
+        'socket'          => null,
35 35
 
36 36
         ########################### DOCS
37 37
         // autor que gerou o script
38
-        'author'          => "Pedro" ,
39
-        'license'         => "New BSD License" ,
40
-        'copyright'       => "ORM Generator - Pedro151" ,
41
-        'link'            => 'https://github.com/pedro151/orm-generator' ,
38
+        'author'          => "Pedro",
39
+        'license'         => "New BSD License",
40
+        'copyright'       => "ORM Generator - Pedro151",
41
+        'link'            => 'https://github.com/pedro151/orm-generator',
42 42
         // data que foi gerado o script
43
-        'last_modify'     => null ,
43
+        'last_modify'     => null,
44 44
 
45 45
         ########################## Ambiente/Arquivos
46 46
 
47 47
         // Nome do framework para o adapter
48
-        'framework'       => null ,
48
+        'framework'       => null,
49 49
         // namespace das classes
50
-        'namespace'       => "" ,
50
+        'namespace'       => "",
51 51
         // caminho onde os arquivos devem ser criados
52
-        'path'            => 'models' ,
52
+        'path'            => 'models',
53 53
         // flag para gerar pasta com o nome do driver do banco de dados
54 54
         'folder-database' => 0,
55 55
         // string com o nome da pastar personalizada
@@ -57,27 +57,27 @@  discard block
 block discarded – undo
57 57
 
58 58
         ############################## Comandos adicionais
59 59
         //flag para mostrar o status da execução ao termino do processo
60
-        'status'          => false ,
60
+        'status'          => false,
61 61
         // flags para criar todas as tabelas ou nao
62
-        'allTables'       => true ,
62
+        'allTables'       => true,
63 63
         //Lista de tabelas a serem ignoradas
64
-        'ignoreTable'     => array () ,
64
+        'ignoreTable'     => array(),
65 65
     );
66 66
 
67 67
     /**
68 68
      * @var string[] um array com todos os campos obrigatorios
69 69
      */
70
-    protected $attRequered = array (
71
-        'driver'   => true ,
72
-        'database' => true ,
73
-        'host'     => true ,
74
-        'username' => true ,
70
+    protected $attRequered = array(
71
+        'driver'   => true,
72
+        'database' => true,
73
+        'host'     => true,
74
+        'username' => true,
75 75
         'path'     => true
76 76
     );
77 77
 
78
-    protected $arrFunc = array ();
78
+    protected $arrFunc = array();
79 79
 
80
-    private $framworkFiles = array ();
80
+    private $framworkFiles = array();
81 81
 
82 82
     const SEPARETOR = "";
83 83
 
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
      *
87 87
      * @return bool
88 88
      */
89
-    protected function checkConfig ()
89
+    protected function checkConfig()
90 90
     {
91
-        if ( array_diff_key ( $this->attRequered , array_filter ( $this->arrConfig ) ) )
91
+        if (array_diff_key($this->attRequered, array_filter($this->arrConfig)))
92 92
         {
93 93
             return false;
94 94
         }
@@ -101,33 +101,33 @@  discard block
 block discarded – undo
101 101
      *
102 102
      * @return array
103 103
      */
104
-    abstract protected function getParams ();
104
+    abstract protected function getParams();
105 105
 
106 106
     /**
107 107
      * Popula as config do generater com as configuraçoes do framework
108 108
      *
109 109
      * @return mixed
110 110
      */
111
-    abstract protected function parseFrameworkConfig ();
111
+    abstract protected function parseFrameworkConfig();
112 112
 
113 113
     /**
114 114
      * Cria Instancias dos arquivos que devem ser gerados
115 115
      *
116 116
      * @return \Classes\AdapterMakerFile\AbstractAdapter[]
117 117
      */
118
-    abstract public function getMakeFileInstances ();
118
+    abstract public function getMakeFileInstances();
119 119
 
120
-    abstract protected function init ();
120
+    abstract protected function init();
121 121
 
122 122
     /**
123 123
      * retorna a base do Namespace
124 124
      *
125 125
      * @return array
126 126
      */
127
-    protected function getBaseNamespace ()
127
+    protected function getBaseNamespace()
128 128
     {
129
-        return array (
130
-            $this->arrConfig[ 'namespace' ] ,
129
+        return array(
130
+            $this->arrConfig['namespace'],
131 131
             'Model'
132 132
         );
133 133
     }
@@ -138,51 +138,51 @@  discard block
 block discarded – undo
138 138
      * @return mixed
139 139
      */
140 140
 
141
-    public function createClassNamespace ( $table )
141
+    public function createClassNamespace($table)
142 142
     {
143
-        $arrNames = $this->getBaseNamespace ();
143
+        $arrNames = $this->getBaseNamespace();
144 144
 
145
-        if ( isset( $this->arrConfig[ 'folder-database' ] )
146
-             && $this->arrConfig[ 'folder-database' ]
145
+        if (isset($this->arrConfig['folder-database'])
146
+             && $this->arrConfig['folder-database']
147 147
         )
148 148
         {
149
-            $arrNames[] = AbstractMaker::getClassName ( $this->arrConfig[ 'driver' ] );
149
+            $arrNames[] = AbstractMaker::getClassName($this->arrConfig['driver']);
150 150
         }
151 151
 
152
-        if ( isset( $this->arrConfig[ 'folder-name' ] )
153
-             && $this->arrConfig[ 'folder-name' ]
152
+        if (isset($this->arrConfig['folder-name'])
153
+             && $this->arrConfig['folder-name']
154 154
         )
155 155
         {
156
-            $arrNames[] = AbstractMaker::getClassName ( $this->arrConfig[ 'folder-name' ] );
156
+            $arrNames[] = AbstractMaker::getClassName($this->arrConfig['folder-name']);
157 157
         }
158 158
 
159
-        if ( $table->hasSchema () )
159
+        if ($table->hasSchema())
160 160
         {
161
-            $arrNames[] = AbstractMaker::getClassName ( $table->getSchema () );
161
+            $arrNames[] = AbstractMaker::getClassName($table->getSchema());
162 162
         } else
163 163
         {
164
-            $arrNames[] = AbstractMaker::getClassName ( $table->getDatabase () );
164
+            $arrNames[] = AbstractMaker::getClassName($table->getDatabase());
165 165
         }
166 166
 
167
-        return implode ( static::SEPARETOR , array_filter ( $arrNames ) );
167
+        return implode(static::SEPARETOR, array_filter($arrNames));
168 168
     }
169 169
 
170
-    public function __construct ( $array )
170
+    public function __construct($array)
171 171
     {
172
-        $array += array (
173
-            'author'      => ucfirst ( get_current_user () ) ,
174
-            'last_modify' => date ( "d-m-Y H:i:s." )
172
+        $array += array(
173
+            'author'      => ucfirst(get_current_user()),
174
+            'last_modify' => date("d-m-Y H:i:s.")
175 175
         );
176 176
 
177
-        $this->setFrameworkFiles ( $array );
178
-        $this->parseFrameworkConfig ();
179
-        $this->setParams ( $this->getParams () );
180
-        $this->setParams ( $array );
181
-        $this->init ();
182
-        if ( ! $this->isValid () )
177
+        $this->setFrameworkFiles($array);
178
+        $this->parseFrameworkConfig();
179
+        $this->setParams($this->getParams());
180
+        $this->setParams($array);
181
+        $this->init();
182
+        if ( ! $this->isValid())
183 183
         {
184
-            $var = array_diff_key ( $this->attRequered , array_filter ( $this->arrConfig ) );
185
-            throw new Exception( $var );
184
+            $var = array_diff_key($this->attRequered, array_filter($this->arrConfig));
185
+            throw new Exception($var);
186 186
         }
187 187
     }
188 188
 
@@ -191,47 +191,47 @@  discard block
 block discarded – undo
191 191
      *
192 192
      * @param $array
193 193
      */
194
-    public function setFrameworkFiles ( $array )
194
+    public function setFrameworkFiles($array)
195 195
     {
196
-        $this->framworkFiles[ 'library' ] = isset( $array[ 'framework-path-library' ] )
197
-            ? $array[ 'framework-path-library' ]
196
+        $this->framworkFiles['library'] = isset($array['framework-path-library'])
197
+            ? $array['framework-path-library']
198 198
             : null;
199 199
 
200
-        $this->framworkFiles[ 'ini' ] = isset( $array[ 'framework-ini' ] )
201
-            ? $array[ 'framework-ini' ]
200
+        $this->framworkFiles['ini'] = isset($array['framework-ini'])
201
+            ? $array['framework-ini']
202 202
             : null;
203 203
 
204
-        $this->framworkFiles[ 'environment' ] = isset( $array[ 'environment' ] )
205
-            ? $array[ 'environment' ]
204
+        $this->framworkFiles['environment'] = isset($array['environment'])
205
+            ? $array['environment']
206 206
             : 'production';
207 207
 
208 208
     }
209 209
 
210
-    protected function isValidFrameworkFiles ()
210
+    protected function isValidFrameworkFiles()
211 211
     {
212
-        if ( ! is_file ( $this->framworkFiles[ 'ini' ] ) )
212
+        if ( ! is_file($this->framworkFiles['ini']))
213 213
         {
214 214
             return false;
215 215
         }
216 216
 
217
-        if ( ! is_dir ( $this->framworkFiles[ 'library' ] ) )
217
+        if ( ! is_dir($this->framworkFiles['library']))
218 218
         {
219 219
             return false;
220 220
         }
221 221
 
222 222
 
223
-        if ( ! isset ( $this->framworkFiles[ 'environment' ] )
224
-             or empty( $this->framworkFiles[ 'environment' ] )
223
+        if ( ! isset ($this->framworkFiles['environment'])
224
+             or empty($this->framworkFiles['environment'])
225 225
         )
226 226
         {
227 227
             return false;
228 228
         }
229
-        set_include_path (
230
-            implode (
231
-                PATH_SEPARATOR ,
232
-                array (
233
-                    realpath ( $this->framworkFiles[ 'library' ] ) ,
234
-                    get_include_path () ,
229
+        set_include_path(
230
+            implode(
231
+                PATH_SEPARATOR,
232
+                array(
233
+                    realpath($this->framworkFiles['library']),
234
+                    get_include_path(),
235 235
                 )
236 236
             )
237 237
         );
@@ -239,120 +239,120 @@  discard block
 block discarded – undo
239 239
         return true;
240 240
     }
241 241
 
242
-    protected function getFrameworkIni ()
242
+    protected function getFrameworkIni()
243 243
     {
244
-        return $this->framworkFiles[ 'ini' ];
244
+        return $this->framworkFiles['ini'];
245 245
     }
246 246
 
247
-    protected function getEnvironment ()
247
+    protected function getEnvironment()
248 248
     {
249
-        return $this->framworkFiles[ 'environment' ];
249
+        return $this->framworkFiles['environment'];
250 250
     }
251 251
 
252 252
     /**
253 253
      * Popula as variaveis de acordo com o arquivo de configuração do seu  framework
254 254
      */
255
-    protected function isValid ()
255
+    protected function isValid()
256 256
     {
257
-        return $this->checkConfig ();
257
+        return $this->checkConfig();
258 258
     }
259 259
 
260
-    private function setParams ( $array )
260
+    private function setParams($array)
261 261
     {
262
-        if ( count ( $array ) > 0 )
262
+        if (count($array) > 0)
263 263
         {
264
-            $this->arrConfig = array_filter ( $array ) + $this->arrConfig;
264
+            $this->arrConfig = array_filter($array) + $this->arrConfig;
265 265
         }
266 266
     }
267 267
 
268 268
     /**
269 269
      * @return string
270 270
      */
271
-    public function getDatabase ()
271
+    public function getDatabase()
272 272
     {
273
-        return $this->arrConfig[ 'database' ];
273
+        return $this->arrConfig['database'];
274 274
     }
275 275
 
276 276
     /**
277 277
      * @return bool
278 278
      */
279
-    public function hasSchemas ()
279
+    public function hasSchemas()
280 280
     {
281
-        return ! empty ( $this->arrConfig[ 'schema' ] );
281
+        return ! empty ($this->arrConfig['schema']);
282 282
     }
283 283
 
284 284
     /**
285 285
      * @return string[]
286 286
      */
287
-    public function getSchemas ()
287
+    public function getSchemas()
288 288
     {
289
-        if ( is_string ( $this->arrConfig[ 'schema' ] ) )
289
+        if (is_string($this->arrConfig['schema']))
290 290
         {
291
-            return array ( $this->arrConfig[ 'schema' ] );
291
+            return array($this->arrConfig['schema']);
292 292
         }
293 293
 
294
-        return $this->arrConfig[ 'schema' ];
294
+        return $this->arrConfig['schema'];
295 295
     }
296 296
 
297
-    public function setSchema ( $schema )
297
+    public function setSchema($schema)
298 298
     {
299
-        $this->arrConfig[ 'schema' ] = $schema;
299
+        $this->arrConfig['schema'] = $schema;
300 300
     }
301 301
 
302 302
     /**
303 303
      * @return string
304 304
      */
305
-    public function getHost ()
305
+    public function getHost()
306 306
     {
307
-        return $this->arrConfig[ 'host' ];
307
+        return $this->arrConfig['host'];
308 308
     }
309 309
 
310 310
     /**
311 311
      * @return int
312 312
      */
313
-    public function getPort ()
313
+    public function getPort()
314 314
     {
315
-        return $this->arrConfig[ 'port' ];
315
+        return $this->arrConfig['port'];
316 316
     }
317 317
 
318 318
     /**
319 319
      * @return boolean
320 320
      */
321
-    public function hasPort ()
321
+    public function hasPort()
322 322
     {
323
-        return ! empty( $this->arrConfig[ 'port' ] );
323
+        return ! empty($this->arrConfig['port']);
324 324
     }
325 325
 
326 326
     /**
327 327
      * @return string
328 328
      */
329
-    public function getSocket ()
329
+    public function getSocket()
330 330
     {
331
-        return $this->arrConfig[ 'socket' ];
331
+        return $this->arrConfig['socket'];
332 332
     }
333 333
 
334 334
     /**
335 335
      * @return string
336 336
      */
337
-    public function getUser ()
337
+    public function getUser()
338 338
     {
339
-        return $this->arrConfig[ 'username' ];
339
+        return $this->arrConfig['username'];
340 340
     }
341 341
 
342 342
     /**
343 343
      * @return string
344 344
      */
345
-    public function getPassword ()
345
+    public function getPassword()
346 346
     {
347
-        return $this->arrConfig[ 'password' ];
347
+        return $this->arrConfig['password'];
348 348
     }
349 349
 
350 350
     /**
351 351
      * @return bool
352 352
      */
353
-    public function isStatusEnabled ()
353
+    public function isStatusEnabled()
354 354
     {
355
-        return (bool) $this->arrConfig[ 'status' ];
355
+        return (bool) $this->arrConfig['status'];
356 356
     }
357 357
 
358 358
     /**
@@ -360,24 +360,24 @@  discard block
 block discarded – undo
360 360
      *
361 361
      * @return string
362 362
      */
363
-    public function __get ( $str )
363
+    public function __get($str)
364 364
     {
365
-        $arr = array (
366
-            'namespace' ,
367
-            'framework' ,
368
-            'author' ,
369
-            'license' ,
370
-            'copyright' ,
371
-            'link' ,
372
-            'last_modify' ,
373
-            'path' ,
365
+        $arr = array(
366
+            'namespace',
367
+            'framework',
368
+            'author',
369
+            'license',
370
+            'copyright',
371
+            'link',
372
+            'last_modify',
373
+            'path',
374 374
             'folder-database',
375 375
             'folder-name'
376 376
         );
377 377
 
378
-        if ( in_array ( $str , $arr ) )
378
+        if (in_array($str, $arr))
379 379
         {
380
-            return $this->arrConfig[ strtolower ( $str ) ];
380
+            return $this->arrConfig[strtolower($str)];
381 381
         }
382 382
 
383 383
         return;
Please login to merge, or discard this patch.
build/Classes/Config.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
     private $adapterDriver;
66 66
 
67 67
     private $frameworkList  = array (
68
-           'none', 'zf1', 'phalcon'
68
+            'none', 'zf1', 'phalcon'
69 69
         );
70 70
 
71 71
     public function __construct ( $argv, $basePath )
Please login to merge, or discard this patch.
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     /**
53 53
      * @var array
54 54
      */
55
-    private $argv = array ();
55
+    private $argv = array();
56 56
 
57 57
     /**
58 58
      * @var \Classes\AdapterConfig\AbstractAdapter
@@ -64,20 +64,20 @@  discard block
 block discarded – undo
64 64
      */
65 65
     private $adapterDriver;
66 66
 
67
-    private $frameworkList  = array (
67
+    private $frameworkList = array(
68 68
            'none', 'zf1', 'phalcon'
69 69
         );
70 70
 
71
-    public function __construct ( $argv, $basePath )
71
+    public function __construct($argv, $basePath)
72 72
     {
73
-        if ( array_key_exists ( 'help', $argv ) ) {
74
-            die ( $this->getUsage () );
73
+        if (array_key_exists('help', $argv)) {
74
+            die ($this->getUsage());
75 75
         }
76
-        if ( array_key_exists ( 'status', $argv ) ) {
77
-            $argv[ 'status' ] = true;
76
+        if (array_key_exists('status', $argv)) {
77
+            $argv['status'] = true;
78 78
         }
79 79
 
80
-        $this->argv = $this->parseConfig ( $basePath, $argv );
80
+        $this->argv = $this->parseConfig($basePath, $argv);
81 81
     }
82 82
 
83 83
     /**
@@ -85,9 +85,9 @@  discard block
 block discarded – undo
85 85
      *
86 86
      * @return string
87 87
      */
88
-    public function getUsage ()
88
+    public function getUsage()
89 89
     {
90
-        $version = $this->getVersion ();
90
+        $version = $this->getVersion();
91 91
 
92 92
         return <<<EOF
93 93
 parameters:
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 EOF;
111 111
     }
112 112
 
113
-    public function getVersion ()
113
+    public function getVersion()
114 114
     {
115 115
         $version = static::$version;
116 116
 
@@ -126,26 +126,26 @@  discard block
 block discarded – undo
126 126
      * @return array
127 127
      * @throws \Exception
128 128
      */
129
-    private function parseConfig ( $basePath, $argv )
129
+    private function parseConfig($basePath, $argv)
130 130
     {
131
-        $this->_basePath = dirname ( $basePath );
131
+        $this->_basePath = dirname($basePath);
132 132
 
133
-        $configIni = isset( $argv[ 'config-ini' ] ) ? $argv[ 'config-ini' ]
133
+        $configIni = isset($argv['config-ini']) ? $argv['config-ini']
134 134
             : $this->_basePath . $this->configIniDefault;
135 135
 
136
-        $configTemp    = $this->loadIniFile ( realpath ( $configIni ) );
137
-        $configCurrent = self::parseConfigEnv ( $configTemp, $argv );
136
+        $configTemp    = $this->loadIniFile(realpath($configIni));
137
+        $configCurrent = self::parseConfigEnv($configTemp, $argv);
138 138
 
139
-        if ( !isset( $configCurrent[ 'framework' ] ) ) {
140
-            throw new \Exception( "configure which framework you want to use! \n" );
139
+        if ( ! isset($configCurrent['framework'])) {
140
+            throw new \Exception("configure which framework you want to use! \n");
141 141
         }
142 142
 
143
-        if ( !in_array ( $configCurrent[ 'framework' ], $this->frameworkList ) ) {
143
+        if ( ! in_array($configCurrent['framework'], $this->frameworkList)) {
144 144
             $frameworks = implode("\n\t", $this->frameworkList);
145
-            throw new \Exception( "list of frameworks: \n\t\033[1;33m".$frameworks."\n\033[0m" );
145
+            throw new \Exception("list of frameworks: \n\t\033[1;33m" . $frameworks . "\n\033[0m");
146 146
         }
147 147
 
148
-        return $argv + array_filter ( $configCurrent );
148
+        return $argv + array_filter($configCurrent);
149 149
     }
150 150
 
151 151
     /**
@@ -155,21 +155,21 @@  discard block
 block discarded – undo
155 155
      *
156 156
      * @return string
157 157
      */
158
-    private static function parseConfigEnv ( $configTemp, $argv )
158
+    private static function parseConfigEnv($configTemp, $argv)
159 159
     {
160
-        $thisSection = isset( $configTemp[ key ( $configTemp ) ][ 'config-env' ] ) ?
161
-            $configTemp[ key ( $configTemp ) ][ 'config-env' ] : null;
160
+        $thisSection = isset($configTemp[key($configTemp)]['config-env']) ?
161
+            $configTemp[key($configTemp)]['config-env'] : null;
162 162
 
163
-        $thisSection = isset( $argv[ 'config-env' ] ) ? $argv[ 'config-env' ]
163
+        $thisSection = isset($argv['config-env']) ? $argv['config-env']
164 164
             : $thisSection;
165 165
 
166
-        if ( isset( $configTemp[ $thisSection ][ 'extends' ] ) ) {
166
+        if (isset($configTemp[$thisSection]['extends'])) {
167 167
             #faz marge da config principal com a config extendida
168
-            return $configTemp[ $thisSection ]
169
-                   + $configTemp[ $configTemp[ $thisSection ][ 'extends' ] ];
168
+            return $configTemp[$thisSection]
169
+                   + $configTemp[$configTemp[$thisSection]['extends']];
170 170
         }
171 171
 
172
-        return $configTemp[ key ( $configTemp ) ];
172
+        return $configTemp[key($configTemp)];
173 173
     }
174 174
 
175 175
     /**
@@ -183,29 +183,29 @@  discard block
 block discarded – undo
183 183
      * @throws \Exception
184 184
      * @return array
185 185
      */
186
-    protected function loadIniFile ( $filename )
186
+    protected function loadIniFile($filename)
187 187
     {
188
-        if ( !is_file ( $filename ) ) {
189
-            throw new \Exception( "configuration file does not exist! \n" );
188
+        if ( ! is_file($filename)) {
189
+            throw new \Exception("configuration file does not exist! \n");
190 190
         }
191 191
 
192
-        $loaded   = parse_ini_file ( $filename, true );
193
-        $iniArray = array ();
194
-        foreach ( $loaded as $key => $data ) {
195
-            $pieces      = explode ( $this->sectionSeparator, $key );
196
-            $thisSection = trim ( $pieces[ 0 ] );
197
-            switch ( count ( $pieces ) ) {
192
+        $loaded   = parse_ini_file($filename, true);
193
+        $iniArray = array();
194
+        foreach ($loaded as $key => $data) {
195
+            $pieces      = explode($this->sectionSeparator, $key);
196
+            $thisSection = trim($pieces[0]);
197
+            switch (count($pieces)) {
198 198
                 case 1:
199
-                    $iniArray[ $thisSection ] = $data;
199
+                    $iniArray[$thisSection] = $data;
200 200
                     break;
201 201
 
202 202
                 case 2:
203
-                    $extendedSection          = trim ( $pieces[ 1 ] );
204
-                    $iniArray[ $thisSection ] = array_merge ( array ( 'extends' => $extendedSection ), $data );
203
+                    $extendedSection          = trim($pieces[1]);
204
+                    $iniArray[$thisSection] = array_merge(array('extends' => $extendedSection), $data);
205 205
                     break;
206 206
 
207 207
                 default:
208
-                    throw new \Exception( "Section '$thisSection' may not extend multiple sections in $filename" );
208
+                    throw new \Exception("Section '$thisSection' may not extend multiple sections in $filename");
209 209
             }
210 210
         }
211 211
 
@@ -218,15 +218,15 @@  discard block
 block discarded – undo
218 218
      * @return \Classes\AdapterConfig\AbstractAdapter
219 219
      *
220 220
      */
221
-    private function factoryConfig ()
221
+    private function factoryConfig()
222 222
     {
223
-        switch ( strtolower ( $this->argv[ 'framework' ] ) ) {
223
+        switch (strtolower($this->argv['framework'])) {
224 224
             case 'zf1':
225
-                return new ZendFrameworkOne( $this->argv );
225
+                return new ZendFrameworkOne($this->argv);
226 226
             case 'phalcon':
227
-                return new Phalcon( $this->argv );
227
+                return new Phalcon($this->argv);
228 228
             default:
229
-                return new None( $this->argv );
229
+                return new None($this->argv);
230 230
         }
231 231
 
232 232
     }
@@ -236,31 +236,31 @@  discard block
 block discarded – undo
236 236
      *
237 237
      * @return  \Classes\AdapterConfig\AbstractAdapter
238 238
      */
239
-    private function factoryDriver ()
239
+    private function factoryDriver()
240 240
     {
241
-        switch ( $this->argv[ 'driver' ] ) {
241
+        switch ($this->argv['driver']) {
242 242
             case 'pgsql':
243 243
             case 'pdo_pgsql':
244
-                return new Pgsql( $this->getAdapterConfig () );
244
+                return new Pgsql($this->getAdapterConfig());
245 245
             case 'mysql':
246 246
             case 'pdo_mysql':
247
-                return new Mysql( $this->getAdapterConfig () );
247
+                return new Mysql($this->getAdapterConfig());
248 248
             case 'mssql':
249
-                return new Mssql( $this->getAdapterConfig () );
249
+                return new Mssql($this->getAdapterConfig());
250 250
             case 'dblib':
251
-                return new Dblib( $this->getAdapterConfig () );
251
+                return new Dblib($this->getAdapterConfig());
252 252
             case 'sqlsrv':
253
-                return new Sqlsrv( $this->getAdapterConfig () );
253
+                return new Sqlsrv($this->getAdapterConfig());
254 254
         }
255 255
     }
256 256
 
257 257
     /**
258 258
      * @return AdapterConfig\AbstractAdapter
259 259
      */
260
-    public function getAdapterConfig ()
260
+    public function getAdapterConfig()
261 261
     {
262
-        if ( !$this->adapterConfig instanceof AbstractAdapter ) {
263
-            $this->adapterConfig = $this->factoryConfig ();
262
+        if ( ! $this->adapterConfig instanceof AbstractAdapter) {
263
+            $this->adapterConfig = $this->factoryConfig();
264 264
         }
265 265
 
266 266
         return $this->adapterConfig;
@@ -269,10 +269,10 @@  discard block
 block discarded – undo
269 269
     /**
270 270
      * @return AdaptersDriver\AbsractAdapter
271 271
      */
272
-    public function getAdapterDriver ()
272
+    public function getAdapterDriver()
273 273
     {
274
-        if ( !$this->adapterDriver ) {
275
-            $this->adapterDriver = $this->factoryDriver ();
274
+        if ( ! $this->adapterDriver) {
275
+            $this->adapterDriver = $this->factoryDriver();
276 276
         }
277 277
 
278 278
         return $this->adapterDriver;
Please login to merge, or discard this patch.
build/Classes/MakerFile.php 1 patch
Spacing   +82 added lines, -82 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
@@ -37,161 +37,161 @@  discard block
 block discarded – undo
37 37
      */
38 38
     private $driver;
39 39
 
40
-    public function __construct ( Config $config )
40
+    public function __construct(Config $config)
41 41
     {
42
-        $this->config = $config->getAdapterConfig ();
43
-        $this->driver = $config->getAdapterDriver ();
44
-        $this->parseLocation ( $config->_basePath );
42
+        $this->config = $config->getAdapterConfig();
43
+        $this->driver = $config->getAdapterDriver();
44
+        $this->parseLocation($config->_basePath);
45 45
     }
46 46
 
47 47
     /**
48 48
      * Analisa os caminhos das pastas base
49 49
      */
50
-    public function parseLocation ( $basePath )
50
+    public function parseLocation($basePath)
51 51
     {
52 52
 
53
-        $arrBase = array (
54
-            $basePath ,
53
+        $arrBase = array(
54
+            $basePath,
55 55
             $this->config->path
56 56
         );
57 57
 
58
-        $this->baseLocation = implode ( DIRECTORY_SEPARATOR , array_filter ( $arrBase ) );
58
+        $this->baseLocation = implode(DIRECTORY_SEPARATOR, array_filter($arrBase));
59 59
 
60 60
         # pasta com nome do driver do banco
61 61
         $driverBase = '';
62
-        if ( (bool) @$this->config->{"folder-database"} )
62
+        if ((bool) @$this->config->{"folder-database"} )
63 63
         {
64
-            $classDriver = explode ( '\\' , get_class ( $this->driver ) );
65
-            $driverBase = end ( $classDriver );
64
+            $classDriver = explode('\\', get_class($this->driver));
65
+            $driverBase = end($classDriver);
66 66
         }
67 67
         $folderName = '';
68
-        if ( (bool) @$this->config->{"folder-name"} )
68
+        if ((bool) @$this->config->{"folder-name"} )
69 69
         {
70
-            $folderName = $this->getClassName ( trim ( $this->config->{"folder-name"} ) );
70
+            $folderName = $this->getClassName(trim($this->config->{"folder-name"} ));
71 71
         }
72 72
 
73
-        if ( $this->config->hasSchemas () )
73
+        if ($this->config->hasSchemas())
74 74
         {
75 75
 
76
-            $schemas = $this->config->getSchemas ();
77
-            foreach ( $schemas as $schema )
76
+            $schemas = $this->config->getSchemas();
77
+            foreach ($schemas as $schema)
78 78
             {
79
-                $arrUrl = array (
79
+                $arrUrl = array(
80 80
                     $this->baseLocation,
81 81
                     $driverBase,
82 82
                     $folderName,
83
-                    $this->getClassName ( $schema )
83
+                    $this->getClassName($schema)
84 84
                 );
85 85
 
86
-                $this->location[ $schema ] = implode ( DIRECTORY_SEPARATOR , array_filter ( $arrUrl ) );
87
-                unset( $arrUrl );
86
+                $this->location[$schema] = implode(DIRECTORY_SEPARATOR, array_filter($arrUrl));
87
+                unset($arrUrl);
88 88
             }
89 89
 
90 90
 
91 91
         } else
92 92
         {
93
-            $baseLocation = implode (
94
-                DIRECTORY_SEPARATOR , array_filter ( array (
95
-                        $this->baseLocation ,
96
-                        $driverBase ,
97
-                        $folderName ,
98
-                        $this->getClassName ( $this->getConfig ()->getDatabase () )
93
+            $baseLocation = implode(
94
+                DIRECTORY_SEPARATOR, array_filter(array(
95
+                        $this->baseLocation,
96
+                        $driverBase,
97
+                        $folderName,
98
+                        $this->getClassName($this->getConfig()->getDatabase())
99 99
                     )
100 100
                 )
101 101
             );
102
-            $this->location = array ( $baseLocation );
102
+            $this->location = array($baseLocation);
103 103
         }
104 104
     }
105 105
 
106 106
     /**
107 107
      * @return AdapterConfig\AbstractAdapter
108 108
      */
109
-    public function getConfig ()
109
+    public function getConfig()
110 110
     {
111 111
         return $this->config;
112 112
     }
113 113
 
114 114
     /* Get current time */
115
-    public function startTime ()
115
+    public function startTime()
116 116
     {
117 117
         echo "Starting..\n";
118
-        $this->startTime = microtime ( true );
118
+        $this->startTime = microtime(true);
119 119
     }
120 120
 
121
-    private function getRunTime ()
121
+    private function getRunTime()
122 122
     {
123
-        return round ( ( microtime ( true ) - $this->startTime ) , 3 );
123
+        return round((microtime(true) - $this->startTime), 3);
124 124
     }
125 125
 
126 126
     /**
127 127
      * Executa o Make, criando arquivos e Diretorios
128 128
      */
129
-    public function run ()
129
+    public function run()
130 130
     {
131
-        $this->startTime ();
132
-        $this->driver->runDatabase ();
133
-        $max = $this->driver->getTotalTables () * count ( $this->factoryMakerFile () );
131
+        $this->startTime();
132
+        $this->driver->runDatabase();
133
+        $max = $this->driver->getTotalTables() * count($this->factoryMakerFile());
134 134
         $cur = 0;
135 135
 
136 136
 
137
-        foreach ( $this->location as $schema => $location )
137
+        foreach ($this->location as $schema => $location)
138 138
         {
139
-            foreach ( $this->factoryMakerFile () as $objMakeFile )
139
+            foreach ($this->factoryMakerFile() as $objMakeFile)
140 140
             {
141
-                $path = $location . DIRECTORY_SEPARATOR . $objMakeFile->getPastName ();
142
-                self::makeDir ( $path );
141
+                $path = $location . DIRECTORY_SEPARATOR . $objMakeFile->getPastName();
142
+                self::makeDir($path);
143 143
 
144
-                if ( $objMakeFile->getParentFileTpl () != '' )
144
+                if ($objMakeFile->getParentFileTpl() != '')
145 145
                 {
146 146
                     $fileAbstract = $this->baseLocation
147 147
                                     . DIRECTORY_SEPARATOR
148
-                                    . $objMakeFile->getParentClass () . '.php';
148
+                                    . $objMakeFile->getParentClass() . '.php';
149 149
 
150
-                    $tplAbstract = $this->getParsedTplContents ( $objMakeFile->getParentFileTpl () );
151
-                    self::makeSourcer ( $fileAbstract , $tplAbstract , $objMakeFile->isOverwrite () );
152
-                    unset( $fileAbstract , $tplAbstract );
150
+                    $tplAbstract = $this->getParsedTplContents($objMakeFile->getParentFileTpl());
151
+                    self::makeSourcer($fileAbstract, $tplAbstract, $objMakeFile->isOverwrite());
152
+                    unset($fileAbstract, $tplAbstract);
153 153
                 }
154 154
 
155
-                foreach ( $this->driver->getTables ( $schema ) as $key => $objTables )
155
+                foreach ($this->driver->getTables($schema) as $key => $objTables)
156 156
                 {
157
-                    $total = ceil ( $cur / $max ) * 100;
158
-                    printf ( "\r Creating: %6.2f%%" , $total );
159
-                    $cur ++;
157
+                    $total = ceil($cur / $max) * 100;
158
+                    printf("\r Creating: %6.2f%%", $total);
159
+                    $cur++;
160 160
 
161 161
                     $file = $path
162 162
                             . DIRECTORY_SEPARATOR
163
-                            . self::getClassName ( $objTables->getName () )
163
+                            . self::getClassName($objTables->getName())
164 164
                             . '.php';
165 165
 
166 166
 
167
-                    $tpl = $this->getParsedTplContents (
168
-                        $objMakeFile->getFileTpl () ,
169
-                        $objMakeFile->parseRelation ( $this , $objTables )
170
-                        , $objTables , $objMakeFile
167
+                    $tpl = $this->getParsedTplContents(
168
+                        $objMakeFile->getFileTpl(),
169
+                        $objMakeFile->parseRelation($this, $objTables)
170
+                        , $objTables, $objMakeFile
171 171
 
172 172
                     );
173
-                    self::makeSourcer ( $file , $tpl , $objMakeFile->isOverwrite () );
173
+                    self::makeSourcer($file, $tpl, $objMakeFile->isOverwrite());
174 174
                 }
175 175
 
176 176
             }
177 177
         }
178 178
 
179
-        $this->reportProcess ( $cur );
179
+        $this->reportProcess($cur);
180 180
         echo "\n\033[1;32mSuccessfully process finished!\n\033[0m";
181 181
     }
182 182
 
183
-    private function reportProcess ( $countFiles )
183
+    private function reportProcess($countFiles)
184 184
     {
185
-        if ( $this->config->isStatusEnabled () )
185
+        if ($this->config->isStatusEnabled())
186 186
         {
187
-            $databases = count ( $this->location );
188
-            $countDir = $this->countDiretory ();
189
-            $totalTable = $this->driver->getTotalTables ();
187
+            $databases = count($this->location);
188
+            $countDir = $this->countDiretory();
189
+            $totalTable = $this->driver->getTotalTables();
190 190
             echo "\n------";
191
-            printf ( "\n\r-Files generated:%s" , $countFiles );
192
-            printf ( "\n\r-Diretory generated:%s" , $databases * $countDir );
193
-            printf ( "\n\r-Scanned tables:%s" , $totalTable );
194
-            printf ( "\n\r-Execution time: %ssec" , $this->getRunTime () );
191
+            printf("\n\r-Files generated:%s", $countFiles);
192
+            printf("\n\r-Diretory generated:%s", $databases * $countDir);
193
+            printf("\n\r-Scanned tables:%s", $totalTable);
194
+            printf("\n\r-Execution time: %ssec", $this->getRunTime());
195 195
             echo "\n------";
196 196
         }
197 197
     }
@@ -201,9 +201,9 @@  discard block
 block discarded – undo
201 201
      *
202 202
      * @return AbstractAdapter[]
203 203
      */
204
-    public function factoryMakerFile ()
204
+    public function factoryMakerFile()
205 205
     {
206
-        return $this->config->getMakeFileInstances ();
206
+        return $this->config->getMakeFileInstances();
207 207
     }
208 208
 
209 209
     /**
@@ -211,14 +211,14 @@  discard block
 block discarded – undo
211 211
      *
212 212
      * @return int
213 213
      */
214
-    public function countDiretory ()
214
+    public function countDiretory()
215 215
     {
216 216
         $dir = 0;
217
-        foreach ( $this->factoryMakerFile () as $abstractAdapter )
217
+        foreach ($this->factoryMakerFile() as $abstractAdapter)
218 218
         {
219
-            if ( $abstractAdapter->hasDiretory () )
219
+            if ($abstractAdapter->hasDiretory())
220 220
             {
221
-                $dir ++;
221
+                $dir++;
222 222
             }
223 223
         }
224 224
 
@@ -233,23 +233,23 @@  discard block
 block discarded – undo
233 233
      *
234 234
      * @return String
235 235
      */
236
-    protected function getParsedTplContents ( $tplFile , $vars = array () , \Classes\Db\DbTable $objTables = null , $objMakeFile = null )
236
+    protected function getParsedTplContents($tplFile, $vars = array(), \Classes\Db\DbTable $objTables = null, $objMakeFile = null)
237 237
     {
238 238
 
239
-        $arrUrl = array (
240
-            __DIR__ ,
241
-            'templates' ,
242
-            $this->config->framework ,
239
+        $arrUrl = array(
240
+            __DIR__,
241
+            'templates',
242
+            $this->config->framework,
243 243
             $tplFile
244 244
         );
245 245
 
246
-        $filePath = implode ( DIRECTORY_SEPARATOR , filter_var_array ( $arrUrl ) );
246
+        $filePath = implode(DIRECTORY_SEPARATOR, filter_var_array($arrUrl));
247 247
 
248
-        extract ( $vars );
249
-        ob_start ();
248
+        extract($vars);
249
+        ob_start();
250 250
         require $filePath;
251
-        $data = ob_get_contents ();
252
-        ob_end_clean ();
251
+        $data = ob_get_contents();
252
+        ob_end_clean();
253 253
 
254 254
         return $data;
255 255
     }
Please login to merge, or discard this patch.