GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#13)
by Pedro
04:05
created
generate.php 1 patch
Spacing   +38 added lines, -38 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( "please enable short_open_tag directive in php.ini\n" );
11
+    die("please enable short_open_tag directive in php.ini\n");
12 12
 }
13 13
 
14
-if ( ! ini_get ( 'register_argc_argv' ) )
14
+if ( ! ini_get('register_argc_argv'))
15 15
 {
16
-    die( "please enable register_argc_argv directive in php.ini\n" );
16
+    die("please enable register_argc_argv directive in php.ini\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,34 +65,34 @@  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
-        'config-ini:' ,
75
-        'database:' ,
76
-        'schema:' ,
77
-        'driver:' ,
68
+    $arrValid = array(
69
+        'version',
70
+        'help',
71
+        'status',
72
+        'init',
73
+        'config-env:',
74
+        'config-ini:',
75
+        'database:',
76
+        'schema:',
77
+        'driver:',
78 78
         'tables:',
79
-        'framework:' ,
79
+        'framework:',
80 80
         'path:'
81 81
     );
82 82
 
83
-    $_path = realpath ( __FILE__ );
84
-    $arg   = getopt ( null , $arrValid );
85
-    if ( array_key_exists ( 'init' , $arg ) )
83
+    $_path = realpath(__FILE__);
84
+    $arg   = getopt(null, $arrValid);
85
+    if (array_key_exists('init', $arg))
86 86
     {
87
-        $maker = new \Classes\MakerConfigFile( $arg , $_path );
87
+        $maker = new \Classes\MakerConfigFile($arg, $_path);
88 88
     } else
89 89
     {
90
-        $maker = new \Classes\MakerFile( new \Classes\Config( $arg , $_path, count($argv) ) );
90
+        $maker = new \Classes\MakerFile(new \Classes\Config($arg, $_path, count($argv)));
91 91
     }
92 92
 
93
-    $maker->run ();
93
+    $maker->run();
94 94
 
95
-} catch ( \Exception $e )
95
+} catch (\Exception $e)
96 96
 {
97
-    die( $e->getMessage () );
97
+    die($e->getMessage());
98 98
 }
Please login to merge, or discard this patch.
build/Classes/Config.php 1 patch
Spacing   +68 added lines, -68 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,13 +64,13 @@  discard block
 block discarded – undo
64 64
      */
65 65
     private $adapterDriver;
66 66
 
67
-    private $frameworkList = array (
67
+    private $frameworkList = array(
68 68
         'none',
69 69
         'zf1',
70 70
         'phalcon'
71 71
     );
72 72
 
73
-    private $parameterList = array (
73
+    private $parameterList = array(
74 74
         'init'       => 'Creates the necessary configuration file to start using the orm-generator.',
75 75
         'config-ini' => 'reference to another .ini file configuration (relative path).',
76 76
         'config-env' => 'orm-generator configuration environment.',
@@ -85,19 +85,19 @@  discard block
 block discarded – undo
85 85
         'path'       => "specify where to create the files (default is current directory).",
86 86
     );
87 87
 
88
-    public function __construct ( $argv, $basePath, $numArgs )
88
+    public function __construct($argv, $basePath, $numArgs)
89 89
     {
90
-        if ( array_key_exists ( 'help', $argv ) or ( $numArgs > 1 && count ( $argv ) < 1 ) ) {
91
-            die ( $this->getUsage () );
90
+        if (array_key_exists('help', $argv) or ($numArgs > 1 && count($argv) < 1)) {
91
+            die ($this->getUsage());
92 92
         }
93
-        if ( array_key_exists ( 'version', $argv ) ) {
94
-            die ( $this->getVersion () );
93
+        if (array_key_exists('version', $argv)) {
94
+            die ($this->getVersion());
95 95
         }
96
-        if ( array_key_exists ( 'status', $argv ) ) {
97
-            $argv[ 'status' ] = true;
96
+        if (array_key_exists('status', $argv)) {
97
+            $argv['status'] = true;
98 98
         }
99 99
 
100
-        $this->argv = $this->parseConfig ( $basePath, $argv );
100
+        $this->argv = $this->parseConfig($basePath, $argv);
101 101
     }
102 102
 
103 103
     /**
@@ -105,10 +105,10 @@  discard block
 block discarded – undo
105 105
      *
106 106
      * @return string
107 107
      */
108
-    public function getUsage ()
108
+    public function getUsage()
109 109
     {
110
-        $version = $this->getVersion ();
111
-        $list    = $this->renderParam ();
110
+        $version = $this->getVersion();
111
+        $list    = $this->renderParam();
112 112
 
113 113
         return <<<EOF
114 114
 parameters:
@@ -119,11 +119,11 @@  discard block
 block discarded – undo
119 119
 EOF;
120 120
     }
121 121
 
122
-    public function renderParam ()
122
+    public function renderParam()
123 123
     {
124 124
         $return = "";
125
-        foreach ( $this->parameterList as $param => $desc ) {
126
-            if ( strlen ( $param ) < 5 ) {
125
+        foreach ($this->parameterList as $param => $desc) {
126
+            if (strlen($param) < 5) {
127 127
                 $return .= "\t--" . $param . "\t\t: " . $desc . "\n";
128 128
             }
129 129
             else {
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
         return $return;
136 136
     }
137 137
 
138
-    public function getVersion ()
138
+    public function getVersion()
139 139
     {
140 140
         $version = static::$version;
141 141
 
@@ -151,26 +151,26 @@  discard block
 block discarded – undo
151 151
      * @return array
152 152
      * @throws \Exception
153 153
      */
154
-    private function parseConfig ( $basePath, $argv )
154
+    private function parseConfig($basePath, $argv)
155 155
     {
156
-        $this->_basePath = dirname ( $basePath . '/' );
156
+        $this->_basePath = dirname($basePath . '/');
157 157
 
158
-        $configIni = isset( $argv[ 'config-ini' ] )
159
-            ? $argv[ 'config-ini' ] : $this->configIniDefault;
158
+        $configIni = isset($argv['config-ini'])
159
+            ? $argv['config-ini'] : $this->configIniDefault;
160 160
 
161
-        $configTemp    = $this->loadIniFile ( realpath ( $configIni ) );
162
-        $configCurrent = self::parseConfigEnv ( $configTemp, $argv );
161
+        $configTemp    = $this->loadIniFile(realpath($configIni));
162
+        $configCurrent = self::parseConfigEnv($configTemp, $argv);
163 163
 
164
-        if ( !isset( $configCurrent[ 'framework' ] ) ) {
165
-            throw new \Exception( "configure which framework you want to use! \n" );
164
+        if ( ! isset($configCurrent['framework'])) {
165
+            throw new \Exception("configure which framework you want to use! \n");
166 166
         }
167 167
 
168
-        if ( !in_array ( $configCurrent[ 'framework' ], $this->frameworkList ) ) {
169
-            $frameworks = implode ( "\n\t", $this->frameworkList );
170
-            throw new \Exception( "list of frameworks: \n\t\033[1;33m" . $frameworks . "\n\033[0m" );
168
+        if ( ! in_array($configCurrent['framework'], $this->frameworkList)) {
169
+            $frameworks = implode("\n\t", $this->frameworkList);
170
+            throw new \Exception("list of frameworks: \n\t\033[1;33m" . $frameworks . "\n\033[0m");
171 171
         }
172 172
 
173
-        return $argv + array_filter ( $configCurrent );
173
+        return $argv + array_filter($configCurrent);
174 174
     }
175 175
 
176 176
     /**
@@ -180,20 +180,20 @@  discard block
 block discarded – undo
180 180
      *
181 181
      * @return string
182 182
      */
183
-    private static function parseConfigEnv ( $configTemp, $argv )
183
+    private static function parseConfigEnv($configTemp, $argv)
184 184
     {
185
-        $thisSection = isset( $configTemp[ key ( $configTemp ) ][ 'config-env' ] ) ? $configTemp[ key (
185
+        $thisSection = isset($configTemp[key($configTemp)]['config-env']) ? $configTemp[key(
186 186
             $configTemp
187
-        ) ][ 'config-env' ] : null;
187
+        )]['config-env'] : null;
188 188
 
189
-        $thisSection = isset( $argv[ 'config-env' ] ) ? $argv[ 'config-env' ] : $thisSection;
189
+        $thisSection = isset($argv['config-env']) ? $argv['config-env'] : $thisSection;
190 190
 
191
-        if ( isset( $configTemp[ $thisSection ][ 'extends' ] ) ) {
191
+        if (isset($configTemp[$thisSection]['extends'])) {
192 192
             #faz marge da config principal com a config extendida
193
-            return $configTemp[ $thisSection ] + $configTemp[ $configTemp[ $thisSection ][ 'extends' ] ];
193
+            return $configTemp[$thisSection] + $configTemp[$configTemp[$thisSection]['extends']];
194 194
         }
195 195
 
196
-        return $configTemp[ key ( $configTemp ) ];
196
+        return $configTemp[key($configTemp)];
197 197
     }
198 198
 
199 199
     /**
@@ -207,29 +207,29 @@  discard block
 block discarded – undo
207 207
      * @throws \Exception
208 208
      * @return array
209 209
      */
210
-    protected function loadIniFile ( $filename )
210
+    protected function loadIniFile($filename)
211 211
     {
212
-        if ( !is_file ( $filename ) ) {
213
-            throw new \Exception( "configuration file does not exist! \n" );
212
+        if ( ! is_file($filename)) {
213
+            throw new \Exception("configuration file does not exist! \n");
214 214
         }
215 215
 
216
-        $loaded   = parse_ini_file ( $filename, true );
217
-        $iniArray = array ();
218
-        foreach ( $loaded as $key => $data ) {
219
-            $pieces      = explode ( $this->sectionSeparator, $key );
220
-            $thisSection = trim ( $pieces[ 0 ] );
221
-            switch ( count ( $pieces ) ) {
216
+        $loaded   = parse_ini_file($filename, true);
217
+        $iniArray = array();
218
+        foreach ($loaded as $key => $data) {
219
+            $pieces      = explode($this->sectionSeparator, $key);
220
+            $thisSection = trim($pieces[0]);
221
+            switch (count($pieces)) {
222 222
                 case 1:
223
-                    $iniArray[ $thisSection ] = $data;
223
+                    $iniArray[$thisSection] = $data;
224 224
                     break;
225 225
 
226 226
                 case 2:
227
-                    $extendedSection          = trim ( $pieces[ 1 ] );
228
-                    $iniArray[ $thisSection ] = array_merge ( array ( 'extends' => $extendedSection ), $data );
227
+                    $extendedSection          = trim($pieces[1]);
228
+                    $iniArray[$thisSection] = array_merge(array('extends' => $extendedSection), $data);
229 229
                     break;
230 230
 
231 231
                 default:
232
-                    throw new \Exception( "Section '$thisSection' may not extend multiple sections in $filename" );
232
+                    throw new \Exception("Section '$thisSection' may not extend multiple sections in $filename");
233 233
             }
234 234
         }
235 235
 
@@ -242,15 +242,15 @@  discard block
 block discarded – undo
242 242
      * @return \Classes\AdapterConfig\AbstractAdapter
243 243
      *
244 244
      */
245
-    private function factoryConfig ()
245
+    private function factoryConfig()
246 246
     {
247
-        switch ( strtolower ( $this->argv[ 'framework' ] ) ) {
247
+        switch (strtolower($this->argv['framework'])) {
248 248
             case 'zf1':
249
-                return new ZendFrameworkOne( $this->argv );
249
+                return new ZendFrameworkOne($this->argv);
250 250
             case 'phalcon':
251
-                return new Phalcon( $this->argv );
251
+                return new Phalcon($this->argv);
252 252
             default:
253
-                return new None( $this->argv );
253
+                return new None($this->argv);
254 254
         }
255 255
 
256 256
     }
@@ -262,31 +262,31 @@  discard block
 block discarded – undo
262 262
      *
263 263
      * @return AdaptersDriver\AbsractAdapter
264 264
      */
265
-    private function factoryDriver ( AdapterConfig\AbstractAdapter $config )
265
+    private function factoryDriver(AdapterConfig\AbstractAdapter $config)
266 266
     {
267
-        switch ( $this->argv[ 'driver' ] ) {
267
+        switch ($this->argv['driver']) {
268 268
             case 'pgsql':
269 269
             case 'pdo_pgsql':
270
-                return new Pgsql( $config );
270
+                return new Pgsql($config);
271 271
             case 'mysql':
272 272
             case 'pdo_mysql':
273
-                return new Mysql( $config );
273
+                return new Mysql($config);
274 274
             case 'mssql':
275
-                return new Mssql( $config );
275
+                return new Mssql($config);
276 276
             case 'dblib':
277
-                return new Dblib( $config );
277
+                return new Dblib($config);
278 278
             case 'sqlsrv':
279
-                return new Sqlsrv( $config );
279
+                return new Sqlsrv($config);
280 280
         }
281 281
     }
282 282
 
283 283
     /**
284 284
      * @return AdapterConfig\AbstractAdapter
285 285
      */
286
-    public function getAdapterConfig ()
286
+    public function getAdapterConfig()
287 287
     {
288
-        if ( !$this->adapterConfig instanceof AbstractAdapter ) {
289
-            $this->adapterConfig = $this->factoryConfig ();
288
+        if ( ! $this->adapterConfig instanceof AbstractAdapter) {
289
+            $this->adapterConfig = $this->factoryConfig();
290 290
         }
291 291
 
292 292
         return $this->adapterConfig;
@@ -295,10 +295,10 @@  discard block
 block discarded – undo
295 295
     /**
296 296
      * @return AdaptersDriver\AbsractAdapter
297 297
      */
298
-    public function getAdapterDriver ( AdapterConfig\AbstractAdapter $config )
298
+    public function getAdapterDriver(AdapterConfig\AbstractAdapter $config)
299 299
     {
300
-        if ( !$this->adapterDriver ) {
301
-            $this->adapterDriver = $this->factoryDriver ( $config );
300
+        if ( ! $this->adapterDriver) {
301
+            $this->adapterDriver = $this->factoryDriver($config);
302 302
         }
303 303
 
304 304
         return $this->adapterDriver;
Please login to merge, or discard this patch.