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 (#15)
by Pedro
04:33
created
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/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.
build/phar-generate.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -79,8 +79,7 @@
 block discarded – undo
79 79
     $arg = getopt ( null, $arrValid );
80 80
     if ( array_key_exists ( 'init', $arg ) ) {
81 81
         $maker = new \Classes\MakerConfigFile( $arg, $_path );
82
-    }
83
-    else {
82
+    } else {
84 83
         $maker = new \Classes\MakerFile( new \Classes\Config( $arg, $_path, count ( $argv ) ) );
85 84
     }
86 85
 
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( ! ini_get ( 'short_open_tag' ) )
3
+if ( ! ini_get('short_open_tag'))
4 4
 {
5
-    die( "\033[0;31mError: please enable short_open_tag directive in php.ini\033[0m\n" );
5
+    die("\033[0;31mError: please enable short_open_tag directive in php.ini\033[0m\n");
6 6
 }
7 7
 
8
-if ( ! ini_get ( 'register_argc_argv' ) )
8
+if ( ! ini_get('register_argc_argv'))
9 9
 {
10
-    die( "\033[0;31mError: please enable register_argc_argv directive in php.ini\033[0m\n" );
10
+    die("\033[0;31mError: please enable register_argc_argv directive in php.ini\033[0m\n");
11 11
 }
12 12
 
13
-if ( function_exists ( 'ini_set' ) ) {
14
-    @ini_set ( 'display_errors', 1 );
13
+if (function_exists('ini_set')) {
14
+    @ini_set('display_errors', 1);
15 15
 
16
-    $memoryInBytes = function ( $value ) {
17
-        $unit  = strtolower ( substr ( $value, -1, 1 ) );
16
+    $memoryInBytes = function($value) {
17
+        $unit  = strtolower(substr($value, -1, 1));
18 18
         $value = (int) $value;
19
-        switch ( $unit ) {
19
+        switch ($unit) {
20 20
             case 'g':
21 21
                 $value *= 1024;
22 22
             // no break (cumulative multiplier)
@@ -30,22 +30,22 @@  discard block
 block discarded – undo
30 30
         return $value;
31 31
     };
32 32
 
33
-    $memoryLimit = trim ( ini_get ( 'memory_limit' ) );
33
+    $memoryLimit = trim(ini_get('memory_limit'));
34 34
     // Increase memory_limit if it is lower than 1GB
35
-    if ( $memoryLimit != -1 && $memoryInBytes( $memoryLimit ) < 1024 * 1024 * 1024 ) {
36
-        @ini_set ( 'memory_limit', '1G' );
35
+    if ($memoryLimit != -1 && $memoryInBytes($memoryLimit) < 1024 * 1024 * 1024) {
36
+        @ini_set('memory_limit', '1G');
37 37
     }
38
-    unset( $memoryInBytes, $memoryLimit );
38
+    unset($memoryInBytes, $memoryLimit);
39 39
 }
40 40
 
41
-\Phar::interceptFileFuncs ();
41
+\Phar::interceptFileFuncs();
42 42
 
43
-set_include_path (
44
-    implode (
43
+set_include_path(
44
+    implode(
45 45
         PATH_SEPARATOR,
46
-        array (
47
-            realpath ( __DIR__ ),
48
-            get_include_path (),
46
+        array(
47
+            realpath(__DIR__),
48
+            get_include_path(),
49 49
         )
50 50
     )
51 51
 );
@@ -55,15 +55,15 @@  discard block
 block discarded – undo
55 55
 require_once 'Classes/MakerConfigFile.php';
56 56
 
57 57
 try {
58
-    $_path = realpath (
59
-        str_replace (
58
+    $_path = realpath(
59
+        str_replace(
60 60
             'phar://',
61 61
             '',
62 62
             __DIR__
63 63
         )
64 64
     );
65 65
 
66
-    $arrValid = array (
66
+    $arrValid = array(
67 67
         'version',
68 68
         'help',
69 69
         'status',
@@ -79,18 +79,18 @@  discard block
 block discarded – undo
79 79
         'clean-trash:'
80 80
     );
81 81
 
82
-    $arg = getopt ( null, $arrValid );
83
-    if ( array_key_exists ( 'init', $arg ) ) {
84
-        $maker = new \Classes\MakerConfigFile( $arg, dirname($_path) );
82
+    $arg = getopt(null, $arrValid);
83
+    if (array_key_exists('init', $arg)) {
84
+        $maker = new \Classes\MakerConfigFile($arg, dirname($_path));
85 85
     }
86 86
     else {
87
-        $maker = new \Classes\MakerFile( new \Classes\Config( $arg, dirname($_path), count ( $argv ) ) );
87
+        $maker = new \Classes\MakerFile(new \Classes\Config($arg, dirname($_path), count($argv)));
88 88
     }
89 89
 
90
-    $maker->run ();
90
+    $maker->run();
91 91
 
92
-} catch ( \Exception $e ) {
93
-    die( $e->getMessage () );
92
+} catch (\Exception $e) {
93
+    die($e->getMessage());
94 94
 }
95 95
 
96 96
 __halt_compiler();
97 97
\ No newline at end of file
Please login to merge, or discard this patch.
build/Classes/CleanTrash.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -34,6 +34,9 @@
 block discarded – undo
34 34
         return self::$instance;
35 35
     }
36 36
 
37
+    /**
38
+     * @param string $directory
39
+     */
37 40
     private function scanDir ( $directory )
38 41
     {
39 42
         if(!is_dir($directory)){
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -17,16 +17,16 @@  discard block
 block discarded – undo
17 17
     /**
18 18
      * @type int
19 19
      */
20
-    private $countFileDeleted=0;
20
+    private $countFileDeleted = 0;
21 21
 
22
-    final private function __construct (){ }
22
+    final private function __construct() { }
23 23
 
24 24
     /**
25 25
      * @return \Classes\CleanTrash
26 26
      */
27
-    public static function getInstance ()
27
+    public static function getInstance()
28 28
     {
29
-        if ( self::$instance === null )
29
+        if (self::$instance === null)
30 30
         {
31 31
             self::$instance = new self();
32 32
         }
@@ -34,20 +34,20 @@  discard block
 block discarded – undo
34 34
         return self::$instance;
35 35
     }
36 36
 
37
-    private function scanDir ( $directory )
37
+    private function scanDir($directory)
38 38
     {
39
-        if(!is_dir($directory)){
39
+        if ( ! is_dir($directory)) {
40 40
             return array();
41 41
         }
42 42
 
43
-        $diretories = preg_grep ( '*\.ph*' , scandir ( $directory ) );
44
-        if(!$diretories){
43
+        $diretories = preg_grep('*\.ph*', scandir($directory));
44
+        if ( ! $diretories) {
45 45
             return array();
46 46
         }
47 47
 
48
-        return array_diff ( $diretories, array (
49
-            '..' , '.'
50
-        ) );
48
+        return array_diff($diretories, array(
49
+            '..', '.'
50
+        ));
51 51
     }
52 52
 
53 53
     /**
@@ -57,14 +57,14 @@  discard block
 block discarded – undo
57 57
      *
58 58
      * @return array
59 59
      */
60
-    private function diffFiles ( $path , $driver , $schema = 0 )
60
+    private function diffFiles($path, $driver, $schema = 0)
61 61
     {
62
-        $tables = $driver->getTables ( $schema );
63
-        if(!$tables instanceof DbTables){
62
+        $tables = $driver->getTables($schema);
63
+        if ( ! $tables instanceof DbTables) {
64 64
             return array();
65 65
         }
66 66
         $tablesName = $tables->toArrayFileName();
67
-        return array_diff ( $this->scanDir ( $path ) , $tablesName );
67
+        return array_diff($this->scanDir($path), $tablesName);
68 68
     }
69 69
 
70 70
     /**
@@ -74,14 +74,14 @@  discard block
 block discarded – undo
74 74
      *
75 75
      * @return int
76 76
      */
77
-    public function run ( $path , $driver , $schema = 0 )
77
+    public function run($path, $driver, $schema = 0)
78 78
     {
79 79
         $count = 0;
80
-        foreach ( $this->diffFiles ( $path , $driver , $schema ) as $fileDel )
80
+        foreach ($this->diffFiles($path, $driver, $schema) as $fileDel)
81 81
         {
82
-            if ( unlink ( $path . DIRECTORY_SEPARATOR . $fileDel ) )
82
+            if (unlink($path . DIRECTORY_SEPARATOR . $fileDel))
83 83
             {
84
-                ++ $count;
84
+                ++$count;
85 85
             }
86 86
         }
87 87
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
     /**
94 94
      * @return int
95 95
      */
96
-    public function getNumFilesDeleted ()
96
+    public function getNumFilesDeleted()
97 97
     {
98 98
         return $this->countFileDeleted;
99 99
     }
Please login to merge, or discard this patch.
build/Classes/Maker/AbstractMaker.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
      *
11 11
      * @param $dir
12 12
      */
13
-    public static function makeDir ( $dir )
13
+    public static function makeDir($dir)
14 14
     {
15
-        if ( !is_dir ( $dir ) )
15
+        if ( ! is_dir($dir))
16 16
         {
17
-            if ( !@mkdir ( $dir, 0755, true ) )
17
+            if ( ! @mkdir($dir, 0755, true))
18 18
             {
19
-                die( "\033[0;31mError: could not create directory $dir\033[0m\n" );
19
+                die("\033[0;31mError: could not create directory $dir\033[0m\n");
20 20
             }
21 21
         }
22 22
     }
@@ -28,16 +28,16 @@  discard block
 block discarded – undo
28 28
      *
29 29
      * @return boolean
30 30
      */
31
-    public static function makeSourcer ( $nameFile, $tplContent, $overwrite = false )
31
+    public static function makeSourcer($nameFile, $tplContent, $overwrite = false)
32 32
     {
33
-        if ( !$overwrite && is_file ( $nameFile ) )
33
+        if ( ! $overwrite && is_file($nameFile))
34 34
         {
35 35
             return false;
36 36
         }
37 37
 
38
-        if ( !file_put_contents ( $nameFile, $tplContent ) )
38
+        if ( ! file_put_contents($nameFile, $tplContent))
39 39
         {
40
-            die( "\033[0;31mError: could not write model file $nameFile.\033[0m\n" );
40
+            die("\033[0;31mError: could not write model file $nameFile.\033[0m\n");
41 41
         }
42 42
 
43 43
         return true;
@@ -48,24 +48,24 @@  discard block
 block discarded – undo
48 48
      *
49 49
      * @return string
50 50
      */
51
-    public static function getClassName ( $str )
51
+    public static function getClassName($str)
52 52
     {
53 53
         $temp = '';
54
-        foreach ( explode ( self::SEPARETOR, $str ) as $part )
54
+        foreach (explode(self::SEPARETOR, $str) as $part)
55 55
         {
56
-            $temp .= ucfirst ( $part );
56
+            $temp .= ucfirst($part);
57 57
         }
58 58
 
59 59
         return $temp;
60 60
     }
61 61
 
62
-    protected function getParsedTplContents ( $filePath, $vars = array () )
62
+    protected function getParsedTplContents($filePath, $vars = array())
63 63
     {
64
-        extract ( $vars );
65
-        ob_start ();
64
+        extract($vars);
65
+        ob_start();
66 66
         require $filePath;
67
-        $data = ob_get_contents ();
68
-        ob_end_clean ();
67
+        $data = ob_get_contents();
68
+        ob_end_clean();
69 69
 
70 70
         return $data;
71 71
     }
Please login to merge, or discard this patch.
build/Classes/Config.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
         $configIni = isset( $argv[ 'name-ini' ] )
193 193
             ? $argv[ 'name-ini' ]
194 194
             : $this->_basePath
195
-              . $this->configIniDefault;
195
+                . $this->configIniDefault;
196 196
 
197 197
         $configTemp = $this->loadIniFile ( realpath ( $configIni ) );
198 198
         $configCurrent = self::parseConfigEnv ( $configTemp , $argv );
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
         {
207 207
             $frameworks = implode ( "\n\t" , $this->frameworkList );
208 208
             throw new \Exception( "list of frameworks: \n\t\033[1;33m" . $frameworks
209
-                                  . "\n\033[0m" );
209
+                                    . "\n\033[0m" );
210 210
         }
211 211
 
212 212
         return $argv + array_filter ( $configCurrent );
Please login to merge, or discard this patch.
Spacing   +96 added lines, -96 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,46 +64,46 @@  discard block
 block discarded – undo
64 64
      */
65 65
     private $adapterDriver;
66 66
 
67
-    private $frameworkList = array (
68
-        'none' ,
69
-        'zf1' ,
67
+    private $frameworkList = array(
68
+        'none',
69
+        'zf1',
70 70
         'phalcon'
71 71
     );
72 72
 
73
-    private $parameterList = array (
74
-        'init'        => 'Creates the necessary configuration file to start using the orm-generator.' ,
75
-        'name-ini'  => 'reference to another .ini file configuration (relative path).' ,
76
-        'config-env'  => 'orm-generator configuration environment.' ,
77
-        'framework'   => 'name framework used, which has the contents of the database configurations and framework template.' ,
78
-        'driver'      => 'database driver name (Ex.: pgsql).' ,
79
-        'database'    => 'database name.' ,
80
-        'schema'      => 'database schema name (one or more than one).' ,
81
-        'tables'      => 'table name (parameter can be used more then once).' ,
82
-        'clean-trash' => 'delete all files that do not belong to your Database due' ,
83
-        'status'      => 'show status of implementation carried out after completing the process.' ,
84
-        'version'     => 'shows the version of orm-generator.' ,
85
-        'help'        => "help command explaining all the options and manner of use." ,
86
-        'path'        => "specify where to create the files (default is current directory)." ,
73
+    private $parameterList = array(
74
+        'init'        => 'Creates the necessary configuration file to start using the orm-generator.',
75
+        'name-ini'  => 'reference to another .ini file configuration (relative path).',
76
+        'config-env'  => 'orm-generator configuration environment.',
77
+        'framework'   => 'name framework used, which has the contents of the database configurations and framework template.',
78
+        'driver'      => 'database driver name (Ex.: pgsql).',
79
+        'database'    => 'database name.',
80
+        'schema'      => 'database schema name (one or more than one).',
81
+        'tables'      => 'table name (parameter can be used more then once).',
82
+        'clean-trash' => 'delete all files that do not belong to your Database due',
83
+        'status'      => 'show status of implementation carried out after completing the process.',
84
+        'version'     => 'shows the version of orm-generator.',
85
+        'help'        => "help command explaining all the options and manner of use.",
86
+        'path'        => "specify where to create the files (default is current directory).",
87 87
     );
88 88
 
89
-    public function __construct ( $argv , $basePath , $numArgs )
89
+    public function __construct($argv, $basePath, $numArgs)
90 90
     {
91
-        if ( array_key_exists ( 'help' , $argv ) or ( $numArgs > 1
92
-                                                      && count ( $argv ) < 1 )
91
+        if (array_key_exists('help', $argv) or ($numArgs > 1
92
+                                                      && count($argv) < 1)
93 93
         )
94 94
         {
95
-            die ( $this->getUsage () );
95
+            die ($this->getUsage());
96 96
         }
97
-        if ( array_key_exists ( 'version' , $argv ) )
97
+        if (array_key_exists('version', $argv))
98 98
         {
99
-            die ( $this->getVersion () );
99
+            die ($this->getVersion());
100 100
         }
101
-        if ( array_key_exists ( 'status' , $argv ) )
101
+        if (array_key_exists('status', $argv))
102 102
         {
103
-            $argv[ 'status' ] = true;
103
+            $argv['status'] = true;
104 104
         }
105 105
 
106
-        $this->argv = $this->parseConfig ( $basePath , $argv );
106
+        $this->argv = $this->parseConfig($basePath, $argv);
107 107
     }
108 108
 
109 109
     /**
@@ -111,10 +111,10 @@  discard block
 block discarded – undo
111 111
      *
112 112
      * @return string
113 113
      */
114
-    public function getUsage ()
114
+    public function getUsage()
115 115
     {
116
-        $version = $this->getVersion ();
117
-        $list = $this->renderParam ();
116
+        $version = $this->getVersion();
117
+        $list = $this->renderParam();
118 118
 
119 119
         return <<<EOF
120 120
 parameters:
@@ -125,12 +125,12 @@  discard block
 block discarded – undo
125 125
 EOF;
126 126
     }
127 127
 
128
-    public function renderParam ()
128
+    public function renderParam()
129 129
     {
130 130
         $return = "";
131
-        foreach ( $this->parameterList as $param => $desc )
131
+        foreach ($this->parameterList as $param => $desc)
132 132
         {
133
-            if ( strlen ( $param ) < 5 )
133
+            if (strlen($param) < 5)
134 134
             {
135 135
                 $return .= "\t--" . $param . "\t\t: " . $desc . "\n";
136 136
             } else
@@ -143,37 +143,37 @@  discard block
 block discarded – undo
143 143
         return $return;
144 144
     }
145 145
 
146
-    public function checkHasNewVersion ()
146
+    public function checkHasNewVersion()
147 147
     {
148
-        if ( ! ini_get ( 'file_get_contents' ) )
148
+        if ( ! ini_get('file_get_contents'))
149 149
         {
150 150
             return;
151 151
         }
152 152
 
153
-        $opts = array (
154
-            'http' => array (
155
-                'method' => 'GET' ,
156
-                'header' => array (
153
+        $opts = array(
154
+            'http' => array(
155
+                'method' => 'GET',
156
+                'header' => array(
157 157
                     'User-Agent: PHP'
158 158
                 )
159 159
             )
160 160
         );
161 161
         $context = stream_context_create($opts);
162
-        $tags = json_decode ( file_get_contents ( "https://api.github.com/repos/pedro151/orm-generator/tags" , false, $context) );
162
+        $tags = json_decode(file_get_contents("https://api.github.com/repos/pedro151/orm-generator/tags", false, $context));
163 163
 
164 164
 
165
-        $lastVersion = preg_replace("/[^0-9.]/", "", $tags[ 0 ]->name);
166
-        if ( $lastVersion > static::$version )
165
+        $lastVersion = preg_replace("/[^0-9.]/", "", $tags[0]->name);
166
+        if ($lastVersion > static::$version)
167 167
         {
168 168
             return "\033[0;31mThere is a new version $lastVersion available:\033[0m https://github.com/pedro151/orm-generator\n";
169 169
         }
170 170
     }
171 171
 
172
-    public function getVersion ()
172
+    public function getVersion()
173 173
     {
174 174
         $version = static::$version;
175 175
 
176
-        return "ORM Generator By: Pedro Alarcao Version: $version\n".$this->checkHasNewVersion();
176
+        return "ORM Generator By: Pedro Alarcao Version: $version\n" . $this->checkHasNewVersion();
177 177
     }
178 178
 
179 179
     /**
@@ -185,31 +185,31 @@  discard block
 block discarded – undo
185 185
      * @return array
186 186
      * @throws \Exception
187 187
      */
188
-    private function parseConfig ( $basePath , $argv )
188
+    private function parseConfig($basePath, $argv)
189 189
     {
190 190
         $this->_basePath = $basePath;
191 191
 
192
-        $configIni = isset( $argv[ 'name-ini' ] )
193
-            ? $argv[ 'name-ini' ]
192
+        $configIni = isset($argv['name-ini'])
193
+            ? $argv['name-ini']
194 194
             : $this->_basePath
195 195
               . $this->configIniDefault;
196 196
 
197
-        $configTemp = $this->loadIniFile ( realpath ( $configIni ) );
198
-        $configCurrent = self::parseConfigEnv ( $configTemp , $argv );
197
+        $configTemp = $this->loadIniFile(realpath($configIni));
198
+        $configCurrent = self::parseConfigEnv($configTemp, $argv);
199 199
 
200
-        if ( ! isset( $configCurrent[ 'framework' ] ) )
200
+        if ( ! isset($configCurrent['framework']))
201 201
         {
202
-            throw new \Exception( "configure which framework you want to use! \n" );
202
+            throw new \Exception("configure which framework you want to use! \n");
203 203
         }
204 204
 
205
-        if ( ! in_array ( $configCurrent[ 'framework' ] , $this->frameworkList ) )
205
+        if ( ! in_array($configCurrent['framework'], $this->frameworkList))
206 206
         {
207
-            $frameworks = implode ( "\n\t" , $this->frameworkList );
208
-            throw new \Exception( "list of frameworks: \n\t\033[1;33m" . $frameworks
209
-                                  . "\n\033[0m" );
207
+            $frameworks = implode("\n\t", $this->frameworkList);
208
+            throw new \Exception("list of frameworks: \n\t\033[1;33m" . $frameworks
209
+                                  . "\n\033[0m");
210 210
         }
211 211
 
212
-        return $argv + array_filter ( $configCurrent );
212
+        return $argv + array_filter($configCurrent);
213 213
     }
214 214
 
215 215
     /**
@@ -219,24 +219,24 @@  discard block
 block discarded – undo
219 219
      *
220 220
      * @return string
221 221
      */
222
-    private static function parseConfigEnv ( $configTemp , $argv )
222
+    private static function parseConfigEnv($configTemp, $argv)
223 223
     {
224
-        $thisSection = isset( $configTemp[ key ( $configTemp ) ][ 'config-env' ] )
225
-            ? $configTemp[ key (
224
+        $thisSection = isset($configTemp[key($configTemp)]['config-env'])
225
+            ? $configTemp[key(
226 226
                 $configTemp
227
-            ) ][ 'config-env' ] : null;
227
+            )]['config-env'] : null;
228 228
 
229
-        $thisSection = isset( $argv[ 'config-env' ] ) ? $argv[ 'config-env' ]
229
+        $thisSection = isset($argv['config-env']) ? $argv['config-env']
230 230
             : $thisSection;
231 231
 
232
-        if ( isset( $configTemp[ $thisSection ][ 'extends' ] ) )
232
+        if (isset($configTemp[$thisSection]['extends']))
233 233
         {
234 234
             #faz marge da config principal com a config extendida
235
-            return $configTemp[ $thisSection ]
236
-                   + $configTemp[ $configTemp[ $thisSection ][ 'extends' ] ];
235
+            return $configTemp[$thisSection]
236
+                   + $configTemp[$configTemp[$thisSection]['extends']];
237 237
         }
238 238
 
239
-        return $configTemp[ key ( $configTemp ) ];
239
+        return $configTemp[key($configTemp)];
240 240
     }
241 241
 
242 242
     /**
@@ -250,32 +250,32 @@  discard block
 block discarded – undo
250 250
      * @throws \Exception
251 251
      * @return array
252 252
      */
253
-    protected function loadIniFile ( $filename )
253
+    protected function loadIniFile($filename)
254 254
     {
255
-        if ( ! is_file ( $filename ) )
255
+        if ( ! is_file($filename))
256 256
         {
257
-            throw new \Exception( "\033[0;31mError: configuration file does not exist! \033[0m\n" );
257
+            throw new \Exception("\033[0;31mError: configuration file does not exist! \033[0m\n");
258 258
         }
259 259
 
260
-        $loaded = parse_ini_file ( $filename , true );
261
-        $iniArray = array ();
262
-        foreach ( $loaded as $key => $data )
260
+        $loaded = parse_ini_file($filename, true);
261
+        $iniArray = array();
262
+        foreach ($loaded as $key => $data)
263 263
         {
264
-            $pieces = explode ( $this->sectionSeparator , $key );
265
-            $thisSection = trim ( $pieces[ 0 ] );
266
-            switch ( count ( $pieces ) )
264
+            $pieces = explode($this->sectionSeparator, $key);
265
+            $thisSection = trim($pieces[0]);
266
+            switch (count($pieces))
267 267
             {
268 268
                 case 1:
269
-                    $iniArray[ $thisSection ] = $data;
269
+                    $iniArray[$thisSection] = $data;
270 270
                     break;
271 271
 
272 272
                 case 2:
273
-                    $extendedSection = trim ( $pieces[ 1 ] );
274
-                    $iniArray[ $thisSection ] = array_merge ( array ( 'extends' => $extendedSection ) , $data );
273
+                    $extendedSection = trim($pieces[1]);
274
+                    $iniArray[$thisSection] = array_merge(array('extends' => $extendedSection), $data);
275 275
                     break;
276 276
 
277 277
                 default:
278
-                    throw new \Exception( "Section '$thisSection' may not extend multiple sections in $filename" );
278
+                    throw new \Exception("Section '$thisSection' may not extend multiple sections in $filename");
279 279
             }
280 280
         }
281 281
 
@@ -288,16 +288,16 @@  discard block
 block discarded – undo
288 288
      * @return \Classes\AdapterConfig\AbstractAdapter
289 289
      *
290 290
      */
291
-    private function factoryConfig ()
291
+    private function factoryConfig()
292 292
     {
293
-        switch ( strtolower ( $this->argv[ 'framework' ] ) )
293
+        switch (strtolower($this->argv['framework']))
294 294
         {
295 295
             case 'zf1':
296
-                return new ZendFrameworkOne( $this->argv );
296
+                return new ZendFrameworkOne($this->argv);
297 297
             case 'phalcon':
298
-                return new Phalcon( $this->argv );
298
+                return new Phalcon($this->argv);
299 299
             default:
300
-                return new None( $this->argv );
300
+                return new None($this->argv);
301 301
         }
302 302
 
303 303
     }
@@ -309,33 +309,33 @@  discard block
 block discarded – undo
309 309
      *
310 310
      * @return AdaptersDriver\AbsractAdapter
311 311
      */
312
-    private function factoryDriver ( AdapterConfig\AbstractAdapter $config )
312
+    private function factoryDriver(AdapterConfig\AbstractAdapter $config)
313 313
     {
314
-        switch ( $this->argv[ 'driver' ] )
314
+        switch ($this->argv['driver'])
315 315
         {
316 316
             case 'pgsql':
317 317
             case 'pdo_pgsql':
318
-                return new Pgsql( $config );
318
+                return new Pgsql($config);
319 319
             case 'mysql':
320 320
             case 'pdo_mysql':
321
-                return new Mysql( $config );
321
+                return new Mysql($config);
322 322
             case 'mssql':
323
-                return new Mssql( $config );
323
+                return new Mssql($config);
324 324
             case 'dblib':
325
-                return new Dblib( $config );
325
+                return new Dblib($config);
326 326
             case 'sqlsrv':
327
-                return new Sqlsrv( $config );
327
+                return new Sqlsrv($config);
328 328
         }
329 329
     }
330 330
 
331 331
     /**
332 332
      * @return AdapterConfig\AbstractAdapter
333 333
      */
334
-    public function getAdapterConfig ()
334
+    public function getAdapterConfig()
335 335
     {
336
-        if ( ! $this->adapterConfig instanceof AbstractAdapter )
336
+        if ( ! $this->adapterConfig instanceof AbstractAdapter)
337 337
         {
338
-            $this->adapterConfig = $this->factoryConfig ();
338
+            $this->adapterConfig = $this->factoryConfig();
339 339
         }
340 340
 
341 341
         return $this->adapterConfig;
@@ -344,11 +344,11 @@  discard block
 block discarded – undo
344 344
     /**
345 345
      * @return AdaptersDriver\AbsractAdapter
346 346
      */
347
-    public function getAdapterDriver ( AdapterConfig\AbstractAdapter $config )
347
+    public function getAdapterDriver(AdapterConfig\AbstractAdapter $config)
348 348
     {
349
-        if ( ! $this->adapterDriver )
349
+        if ( ! $this->adapterDriver)
350 350
         {
351
-            $this->adapterDriver = $this->factoryDriver ( $config );
351
+            $this->adapterDriver = $this->factoryDriver($config);
352 352
         }
353 353
 
354 354
         return $this->adapterDriver;
Please login to merge, or discard this patch.
build/Classes/Db/Iterators/DbTables.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
         foreach ( $this->objDbTables as $objDbTable )
56 56
         {
57 57
             $this->toArrayFileName[] = AbstractMaker::getClassName ( $objDbTable->getName () )
58
-                                       . '.php';
58
+                                        . '.php';
59 59
         }
60 60
 
61 61
         return $this->toArrayFileName;
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -5,56 +5,56 @@  discard block
 block discarded – undo
5 5
 use Classes\Db\DbTable;
6 6
 use Classes\Maker\AbstractMaker;
7 7
 
8
-class DbTables implements \ArrayAccess , \SeekableIterator , \Countable
8
+class DbTables implements \ArrayAccess, \SeekableIterator, \Countable
9 9
 {
10 10
 
11 11
     /**
12 12
      * @type DbTable[]
13 13
      */
14
-    private $objDbTables = array ();
14
+    private $objDbTables = array();
15 15
 
16 16
     private $position = 0;
17 17
 
18
-    public function offsetExists ( $offset )
18
+    public function offsetExists($offset)
19 19
     {
20
-        return isset( $this->objDbTables[ trim ( $offset ) ] );
20
+        return isset($this->objDbTables[trim($offset)]);
21 21
     }
22 22
 
23
-    public function offsetGet ( $offset )
23
+    public function offsetGet($offset)
24 24
     {
25
-        return $this->objDbTables[ trim ( $offset ) ];
25
+        return $this->objDbTables[trim($offset)];
26 26
     }
27 27
 
28
-    public function offsetSet ( $offset , $value )
28
+    public function offsetSet($offset, $value)
29 29
     {
30
-        return $this->objDbTables[ trim ( $offset ) ] = $value;
30
+        return $this->objDbTables[trim($offset)] = $value;
31 31
     }
32 32
 
33
-    public function offsetUnset ( $offset )
33
+    public function offsetUnset($offset)
34 34
     {
35
-        unset( $this->objDbTables[ trim ( $offset ) ] );
35
+        unset($this->objDbTables[trim($offset)]);
36 36
 
37 37
         return $this;
38 38
     }
39 39
 
40
-    public function count ()
40
+    public function count()
41 41
     {
42
-        return count ( $this->objDbTables );
42
+        return count($this->objDbTables);
43 43
     }
44 44
 
45 45
     /**
46 46
      * convert array
47 47
      */
48
-    public function toArrayFileName ()
48
+    public function toArrayFileName()
49 49
     {
50
-        if ( ! empty( $this->toArrayFileName ) )
50
+        if ( ! empty($this->toArrayFileName))
51 51
         {
52 52
             return $this->toArrayFileName;
53 53
         }
54 54
 
55
-        foreach ( $this->objDbTables as $objDbTable )
55
+        foreach ($this->objDbTables as $objDbTable)
56 56
         {
57
-            $this->toArrayFileName[] = AbstractMaker::getClassName ( $objDbTable->getName () )
57
+            $this->toArrayFileName[] = AbstractMaker::getClassName($objDbTable->getName())
58 58
                                        . '.php';
59 59
         }
60 60
 
@@ -63,12 +63,12 @@  discard block
 block discarded – undo
63 63
 
64 64
     /* Method required for SeekableIterator interface */
65 65
 
66
-    public function seek ( $position )
66
+    public function seek($position)
67 67
     {
68
-        $current = array_keys ( $this->objDbTables );
69
-        if ( ! isset( $this->objDbTables[ $current[ $position ] ] ) )
68
+        $current = array_keys($this->objDbTables);
69
+        if ( ! isset($this->objDbTables[$current[$position]]))
70 70
         {
71
-            throw new OutOfBoundsException( "invalid seek position ($position)" );
71
+            throw new OutOfBoundsException("invalid seek position ($position)");
72 72
         }
73 73
 
74 74
         $this->position = $position;
@@ -76,34 +76,34 @@  discard block
 block discarded – undo
76 76
 
77 77
     /* Methods required for Iterator interface */
78 78
 
79
-    public function rewind ()
79
+    public function rewind()
80 80
     {
81 81
         $this->position = 0;
82 82
     }
83 83
 
84
-    public function current ()
84
+    public function current()
85 85
     {
86
-        $current = array_keys ( $this->objDbTables );
86
+        $current = array_keys($this->objDbTables);
87 87
 
88
-        return $this->objDbTables[ $current[ $this->position ] ];
88
+        return $this->objDbTables[$current[$this->position]];
89 89
     }
90 90
 
91
-    public function key ()
91
+    public function key()
92 92
     {
93
-        $current = array_keys ( $this->objDbTables );
93
+        $current = array_keys($this->objDbTables);
94 94
 
95
-        return $current[ $this->position ];
95
+        return $current[$this->position];
96 96
     }
97 97
 
98
-    public function next ()
98
+    public function next()
99 99
     {
100
-        ++ $this->position;
100
+        ++$this->position;
101 101
     }
102 102
 
103
-    public function valid ()
103
+    public function valid()
104 104
     {
105
-        $current = array_keys ( $this->objDbTables );
105
+        $current = array_keys($this->objDbTables);
106 106
 
107
-        return isset( $current[ $this->position ] );
107
+        return isset($current[$this->position]);
108 108
     }
109 109
 }
110 110
\ No newline at end of file
Please login to merge, or discard this patch.
build/Classes/templates/zf1/entity_abstract.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -3,19 +3,19 @@  discard block
 block discarded – undo
3 3
 /**
4 4
  * Application Entity
5 5
  *
6
- * <?=$this->config->last_modify."\n"?>
6
+ * <?=$this->config->last_modify . "\n"?>
7 7
  *
8 8
  * @package   <?=$this->config->namespace?>Model
9 9
  * @subpackage Model
10
- * @author    <?=$this->config->author."\n"?>
10
+ * @author    <?=$this->config->author . "\n"?>
11 11
  *
12
- * @copyright <?=$this->config->copyright."\n"?>
13
- * @license   <?=$this->config->license."\n"?>
14
- * @link      <?=$this->config->link."\n"?>
15
- * @version   <?=$this->config->version."\n"?>
12
+ * @copyright <?=$this->config->copyright . "\n"?>
13
+ * @license   <?=$this->config->license . "\n"?>
14
+ * @link      <?=$this->config->link . "\n"?>
15
+ * @version   <?=$this->config->version . "\n"?>
16 16
  */
17 17
 
18
-abstract class <?=$this->config->namespace?$this->config->namespace."_":""?>Model_EntityAbstract extends Zend_Db_Table_Row_Abstract
18
+abstract class <?=$this->config->namespace ? $this->config->namespace . "_" : ""?>Model_EntityAbstract extends Zend_Db_Table_Row_Abstract
19 19
 {
20 20
 
21 21
     /**
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 
76 76
     /**
77 77
     * @param array $data
78
-    * @return <?=$this->config->namespace?$this->config->namespace."_":""?>Model_EntityAbstract
78
+    * @return <?=$this->config->namespace ? $this->config->namespace . "_" : ""?>Model_EntityAbstract
79 79
     */
80 80
     public static function getIntance($data = array())
81 81
     {
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
     /**
243 243
      * Retorna o nome da coluna da primary key
244 244
      *
245
-     * @see <?=$this->config->namespace?$this->config->namespace."_":""?>Model_DbTable_TableAbstract::getPrimaryKeyName()
245
+     * @see <?=$this->config->namespace ? $this->config->namespace . "_" : ""?>Model_DbTable_TableAbstract::getPrimaryKeyName()
246 246
      * @return string|array The name or array of names which form the primary key
247 247
      */
248 248
     public function getPrimaryKeyName()
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
      * Retorna o objeto pela primary key
255 255
      *
256 256
      * @param int|array $primary_key
257
-     * @return <?=$this->config->namespace?$this->config->namespace."_":""?>Model_EntityAbstract
257
+     * @return <?=$this->config->namespace ? $this->config->namespace . "_" : ""?>Model_EntityAbstract
258 258
      */
259 259
     public static function retrieve ( $primary_key )
260 260
     {
Please login to merge, or discard this patch.
generate.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -6,26 +6,26 @@  discard block
 block discarded – undo
6 6
  * @author Pedro Alarcao <[email protected]>
7 7
  */
8 8
 
9
-if ( ! ini_get ( 'short_open_tag' ) )
9
+if ( ! ini_get('short_open_tag'))
10 10
 {
11
-    die( "\033[0;31mError: please enable short_open_tag directive in php.ini\033[0m\n" );
11
+    die("\033[0;31mError: please enable short_open_tag directive in php.ini\033[0m\n");
12 12
 }
13 13
 
14
-if ( ! ini_get ( 'register_argc_argv' ) )
14
+if ( ! ini_get('register_argc_argv'))
15 15
 {
16
-    die( "\033[0;31mError: please enable register_argc_argv directive in php.ini\033[0m\n" );
16
+    die("\033[0;31mError: please enable register_argc_argv directive in php.ini\033[0m\n");
17 17
 }
18 18
 
19 19
 
20
-if ( function_exists ( 'ini_set' ) )
20
+if (function_exists('ini_set'))
21 21
 {
22
-    @ini_set ( 'display_errors' , 1 );
22
+    @ini_set('display_errors', 1);
23 23
 
24
-    $memoryInBytes = function ( $value )
24
+    $memoryInBytes = function($value)
25 25
     {
26
-        $unit = strtolower ( substr ( $value , - 1 , 1 ) );
26
+        $unit = strtolower(substr($value, - 1, 1));
27 27
         $value = (int) $value;
28
-        switch ( $unit )
28
+        switch ($unit)
29 29
         {
30 30
             case 'g':
31 31
                 $value *= 1024;
@@ -40,21 +40,21 @@  discard block
 block discarded – undo
40 40
         return $value;
41 41
     };
42 42
 
43
-    $memoryLimit = trim ( ini_get ( 'memory_limit' ) );
43
+    $memoryLimit = trim(ini_get('memory_limit'));
44 44
     // Increase memory_limit if it is lower than 1GB
45
-    if ( $memoryLimit != - 1 && $memoryInBytes( $memoryLimit ) < 1024 * 1024 * 1024 )
45
+    if ($memoryLimit != - 1 && $memoryInBytes($memoryLimit) < 1024 * 1024 * 1024)
46 46
     {
47
-        @ini_set ( 'memory_limit' , '1G' );
47
+        @ini_set('memory_limit', '1G');
48 48
     }
49
-    unset( $memoryInBytes , $memoryLimit );
49
+    unset($memoryInBytes, $memoryLimit);
50 50
 }
51 51
 
52
-set_include_path (
53
-    implode (
54
-        PATH_SEPARATOR ,
55
-        array (
56
-            realpath ( dirname ( __FILE__ ) . "/build/" ) ,
57
-            get_include_path () ,
52
+set_include_path(
53
+    implode(
54
+        PATH_SEPARATOR,
55
+        array(
56
+            realpath(dirname(__FILE__) . "/build/"),
57
+            get_include_path(),
58 58
         )
59 59
     )
60 60
 );
@@ -65,35 +65,35 @@  discard block
 block discarded – undo
65 65
 
66 66
 try
67 67
 {
68
-    $arrValid = array (
69
-        'version' ,
70
-        'help' ,
71
-        'status' ,
72
-        'init' ,
73
-        'config-env:' ,
74
-        'name-ini:' ,
75
-        'database:' ,
76
-        'schema:' ,
77
-        'driver:' ,
68
+    $arrValid = array(
69
+        'version',
70
+        'help',
71
+        'status',
72
+        'init',
73
+        'config-env:',
74
+        'name-ini:',
75
+        'database:',
76
+        'schema:',
77
+        'driver:',
78 78
         'tables:',
79
-        'framework:' ,
79
+        'framework:',
80 80
         'path:',
81 81
         'clean-trash:'
82 82
     );
83 83
 
84 84
     $_path = __DIR__;
85
-    $arg   = getopt ( null , $arrValid );
86
-    if ( array_key_exists ( 'init' , $arg ) )
85
+    $arg   = getopt(null, $arrValid);
86
+    if (array_key_exists('init', $arg))
87 87
     {
88
-        $maker = new \Classes\MakerConfigFile( $arg , $_path );
88
+        $maker = new \Classes\MakerConfigFile($arg, $_path);
89 89
     } else
90 90
     {
91
-        $maker = new \Classes\MakerFile( new \Classes\Config( $arg , $_path, count($argv) ) );
91
+        $maker = new \Classes\MakerFile(new \Classes\Config($arg, $_path, count($argv)));
92 92
     }
93 93
 
94
-    $maker->run ();
94
+    $maker->run();
95 95
 
96
-} catch ( \Exception $e )
96
+} catch (\Exception $e)
97 97
 {
98
-    die( $e->getMessage ()  );
98
+    die($e->getMessage());
99 99
 }
Please login to merge, or discard this patch.