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 ( ec79d4...075301 )
by Pedro
04:30 queued 01:48
created
build/Classes/Update/Content/AbstractContent.php 3 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -151,6 +151,10 @@
 block discarded – undo
151 151
         return stream_get_contents ( $handle );
152 152
     }
153 153
 
154
+    /**
155
+     * @param string $url
156
+     * @param string $content
157
+     */
154 158
     public function putContent ( $url , $content )
155 159
     {
156 160
         switch ( $this->objProtocol->getProtocol () )
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -227,11 +227,11 @@
 block discarded – undo
227 227
     function progressCallback ( $download_size , $downloaded_size , $upload_size , $uploaded_size )
228 228
     {
229 229
         ProgressBar::getInstance ()
230
-                   ->clear ()
231
-                   ->setMaxByte ( $download_size )
232
-                   ->setProgress ( $downloaded_size )
233
-                   ->render ()
234
-                   ->finish ();
230
+                    ->clear ()
231
+                    ->setMaxByte ( $download_size )
232
+                    ->setProgress ( $downloaded_size )
233
+                    ->render ()
234
+                    ->finish ();
235 235
 
236 236
     }
237 237
 
Please login to merge, or discard this patch.
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -14,10 +14,10 @@  discard block
 block discarded – undo
14 14
 abstract class AbstractContent
15 15
 {
16 16
 
17
-    private static $opts = array (
18
-        'http' => array (
19
-            'method' => 'GET' ,
20
-            'header' => array (
17
+    private static $opts = array(
18
+        'http' => array(
19
+            'method' => 'GET',
20
+            'header' => array(
21 21
                 'User-Agent: PHP'
22 22
             )
23 23
         )
@@ -35,22 +35,22 @@  discard block
 block discarded – undo
35 35
     /**
36 36
      * @type array
37 37
      */
38
-    private $content = array ();
38
+    private $content = array();
39 39
 
40
-    protected function __construct ()
40
+    protected function __construct()
41 41
     {
42
-        $this->objProtocol = ProtocolFileContent::getInstance ();
43
-        $this->init ();
42
+        $this->objProtocol = ProtocolFileContent::getInstance();
43
+        $this->init();
44 44
     }
45 45
 
46
-    protected function init (){ }
46
+    protected function init() { }
47 47
 
48 48
     /**
49 49
      * @return \Classes\Update\Content
50 50
      */
51
-    public static function getInstance ()
51
+    public static function getInstance()
52 52
     {
53
-        if ( empty( self::$objContent ) )
53
+        if (empty(self::$objContent))
54 54
         {
55 55
             self::$objContent = new static();
56 56
         }
@@ -63,26 +63,26 @@  discard block
 block discarded – undo
63 63
      *
64 64
      * @return string
65 65
      */
66
-    public function getContent ( $url , $progress = false )
66
+    public function getContent($url, $progress = false)
67 67
     {
68
-        if ( ! isset( $this->content[ $url ] ) )
68
+        if ( ! isset($this->content[$url]))
69 69
         {
70
-            $this->content[ $url ] = '';
71
-            switch ( $this->objProtocol->getProtocol () )
70
+            $this->content[$url] = '';
71
+            switch ($this->objProtocol->getProtocol())
72 72
             {
73 73
                 case 'curl':
74
-                    $this->content[ $url ] = $this->getCurlContent ( $url , $progress );
74
+                    $this->content[$url] = $this->getCurlContent($url, $progress);
75 75
                     break;
76 76
                 case 'file_content':
77
-                    $this->content[ $url ] = $this->getFileContent ( $url , $progress );
77
+                    $this->content[$url] = $this->getFileContent($url, $progress);
78 78
                     break;
79 79
                 case 'steam_content':
80
-                    $this->content[ $url ] = $this->getStreamContent ( $url , $progress );
80
+                    $this->content[$url] = $this->getStreamContent($url, $progress);
81 81
                     break;
82 82
             }
83 83
         }
84 84
 
85
-        return $this->content[ $url ];
85
+        return $this->content[$url];
86 86
     }
87 87
 
88 88
     /**
@@ -90,21 +90,21 @@  discard block
 block discarded – undo
90 90
      *
91 91
      * @return string
92 92
      */
93
-    protected function getCurlContent ( $url , $progress = false )
93
+    protected function getCurlContent($url, $progress = false)
94 94
     {
95
-        $conn = curl_init ( $url );
96
-        curl_setopt ( $conn , CURLOPT_RETURNTRANSFER , true );
97
-        curl_setopt ( $conn , CURLOPT_BINARYTRANSFER , true );
98
-        curl_setopt ( $conn , CURLOPT_USERAGENT , self::$opts[ 'http' ][ 'method' ] );
99
-        if ( $progress )
95
+        $conn = curl_init($url);
96
+        curl_setopt($conn, CURLOPT_RETURNTRANSFER, true);
97
+        curl_setopt($conn, CURLOPT_BINARYTRANSFER, true);
98
+        curl_setopt($conn, CURLOPT_USERAGENT, self::$opts['http']['method']);
99
+        if ($progress)
100 100
         {
101
-            curl_setopt ( $conn , CURLOPT_NOPROGRESS , false );
102
-            curl_setopt ( $conn , CURLOPT_PROGRESSFUNCTION , array (
103
-                $this , 'progressCallback'
104
-            ) );
101
+            curl_setopt($conn, CURLOPT_NOPROGRESS, false);
102
+            curl_setopt($conn, CURLOPT_PROGRESSFUNCTION, array(
103
+                $this, 'progressCallback'
104
+            ));
105 105
         }
106
-        $url_get_contents_data = ( curl_exec ( $conn ) );
107
-        curl_close ( $conn );
106
+        $url_get_contents_data = (curl_exec($conn));
107
+        curl_close($conn);
108 108
 
109 109
         return $url_get_contents_data;
110 110
     }
@@ -114,19 +114,19 @@  discard block
 block discarded – undo
114 114
      *
115 115
      * @return string
116 116
      */
117
-    protected function getFileContent ( $url , $progress = false )
117
+    protected function getFileContent($url, $progress = false)
118 118
     {
119
-        $context = stream_context_create ( self::$opts );
120
-        if ( $progress )
119
+        $context = stream_context_create(self::$opts);
120
+        if ($progress)
121 121
         {
122
-            stream_context_set_params ( $context , array (
123
-                "notification" => array (
124
-                    $this , 'stream_notification_callback'
122
+            stream_context_set_params($context, array(
123
+                "notification" => array(
124
+                    $this, 'stream_notification_callback'
125 125
                 )
126
-            ) );
126
+            ));
127 127
         }
128 128
 
129
-        return file_get_contents ( $url , false , $context );
129
+        return file_get_contents($url, false, $context);
130 130
     }
131 131
 
132 132
     /**
@@ -134,52 +134,52 @@  discard block
 block discarded – undo
134 134
      *
135 135
      * @return string
136 136
      */
137
-    protected function getStreamContent ( $url , $progress = false )
137
+    protected function getStreamContent($url, $progress = false)
138 138
     {
139
-        $context = stream_context_create ( self::$opts );
140
-        if ( $progress )
139
+        $context = stream_context_create(self::$opts);
140
+        if ($progress)
141 141
         {
142
-            stream_context_set_params ( $context , array (
143
-                "notification" => array (
144
-                    $this , 'stream_notification_callback'
142
+            stream_context_set_params($context, array(
143
+                "notification" => array(
144
+                    $this, 'stream_notification_callback'
145 145
                 )
146
-            ) );
146
+            ));
147 147
         }
148 148
 
149
-        $handle = fopen ( $url , "r" , null , $context );
149
+        $handle = fopen($url, "r", null, $context);
150 150
 
151
-        return stream_get_contents ( $handle );
151
+        return stream_get_contents($handle);
152 152
     }
153 153
 
154
-    public function putContent ( $url , $content )
154
+    public function putContent($url, $content)
155 155
     {
156
-        switch ( $this->objProtocol->getProtocol () )
156
+        switch ($this->objProtocol->getProtocol())
157 157
         {
158 158
             case 'curl':
159
-                $this->putFopen ( $url , $content );
159
+                $this->putFopen($url, $content);
160 160
                 break;
161 161
             case 'steam_content':
162 162
             case 'file_content':
163
-                $this->putFileContent ( $url , $content );
163
+                $this->putFileContent($url, $content);
164 164
                 break;
165 165
         }
166 166
 
167 167
     }
168 168
 
169
-    public function putFileContent ( $url , $content )
169
+    public function putFileContent($url, $content)
170 170
     {
171 171
         // check if all is OK
172
-        if ( file_put_contents ( $url , $content ) )
172
+        if (file_put_contents($url, $content))
173 173
         {
174
-            ProgressBar::getInstance ()->finish ();
174
+            ProgressBar::getInstance()->finish();
175 175
         }
176 176
     }
177 177
 
178
-    public function putFopen ( $url , $content )
178
+    public function putFopen($url, $content)
179 179
     {
180
-        $fp = fopen ( $url , "a" );
181
-        fwrite ( $fp , $content );
182
-        fclose ( $fp );
180
+        $fp = fopen($url, "a");
181
+        fwrite($fp, $content);
182
+        fclose($fp);
183 183
     }
184 184
 
185 185
     /**
@@ -192,46 +192,46 @@  discard block
 block discarded – undo
192 192
      * @param $bytes_transferred
193 193
      * @param $bytes_max
194 194
      */
195
-    public function stream_notification_callback ( $notificationCode , $severity , $message , $messageCode , $bytesTransferred , $bytesMax )
195
+    public function stream_notification_callback($notificationCode, $severity, $message, $messageCode, $bytesTransferred, $bytesMax)
196 196
     {
197
-        $objProgress = ProgressBar::getInstance ();
198
-        switch ( $notificationCode )
197
+        $objProgress = ProgressBar::getInstance();
198
+        switch ($notificationCode)
199 199
         {
200 200
             case STREAM_NOTIFY_RESOLVE:
201 201
             case STREAM_NOTIFY_AUTH_REQUIRED:
202 202
             case STREAM_NOTIFY_FAILURE:
203 203
             case STREAM_NOTIFY_AUTH_RESULT:
204
-                var_dump ( $notificationCode , $severity , $message , $messageCode , $bytesTransferred , $bytesMax );
204
+                var_dump($notificationCode, $severity, $message, $messageCode, $bytesTransferred, $bytesMax);
205 205
                 /* Ignore */
206 206
                 break;
207 207
             case STREAM_NOTIFY_CONNECT:
208 208
                 echo "\033[1;32mConnected...\033[0m\n";
209 209
                 break;
210 210
             case STREAM_NOTIFY_REDIRECTED:
211
-                $objProgress->clear ();
211
+                $objProgress->clear();
212 212
                 break;
213 213
             case STREAM_NOTIFY_FILE_SIZE_IS:
214
-                $objProgress->clear ()->setMaxByte ( $bytesMax );
214
+                $objProgress->clear()->setMaxByte($bytesMax);
215 215
                 break;
216 216
             case STREAM_NOTIFY_PROGRESS:
217
-                $objProgress->setProgress ( $bytesTransferred )
218
-                            ->render ();
217
+                $objProgress->setProgress($bytesTransferred)
218
+                            ->render();
219 219
                 break;
220 220
             case STREAM_NOTIFY_COMPLETED:
221
-                $objProgress->finish ();
221
+                $objProgress->finish();
222 222
                 break;
223 223
         }
224 224
 
225 225
     }
226 226
 
227
-    function progressCallback ( $download_size , $downloaded_size , $upload_size , $uploaded_size )
227
+    function progressCallback($download_size, $downloaded_size, $upload_size, $uploaded_size)
228 228
     {
229
-        ProgressBar::getInstance ()
230
-                   ->clear ()
231
-                   ->setMaxByte ( $download_size )
232
-                   ->setProgress ( $downloaded_size )
233
-                   ->render ()
234
-                   ->finish ();
229
+        ProgressBar::getInstance()
230
+                   ->clear()
231
+                   ->setMaxByte($download_size)
232
+                   ->setProgress($downloaded_size)
233
+                   ->render()
234
+                   ->finish();
235 235
 
236 236
     }
237 237
 
Please login to merge, or discard this patch.
build/Classes/Update/ProtocolFileContent.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -72,6 +72,7 @@
 block discarded – undo
72 72
     }
73 73
 
74 74
     /**
75
+     * @param string $type
75 76
      * @return bool
76 77
      */
77 78
     private function hasEnabled ( $type )
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -20,17 +20,17 @@  discard block
 block discarded – undo
20 20
      */
21 21
     private static $objProtocol;
22 22
 
23
-    private function __construct ()
23
+    private function __construct()
24 24
     {
25
-        $this->parseContentProtocol ();
25
+        $this->parseContentProtocol();
26 26
     }
27 27
 
28 28
     /**
29 29
      * @return \Classes\Update\ProtocolFileContent
30 30
      */
31
-    public static function getInstance ()
31
+    public static function getInstance()
32 32
     {
33
-        if ( empty( self::$objProtocol ) )
33
+        if (empty(self::$objProtocol))
34 34
         {
35 35
             self::$objProtocol = new ProtocolFileContent();
36 36
         }
@@ -41,15 +41,15 @@  discard block
 block discarded – undo
41 41
     /**
42 42
      * @return bool
43 43
      */
44
-    public function hasProtocol ()
44
+    public function hasProtocol()
45 45
     {
46
-        return ! empty( $this->protocol );
46
+        return ! empty($this->protocol);
47 47
     }
48 48
 
49 49
     /**
50 50
      * @return string
51 51
      */
52
-    public function getProtocol ()
52
+    public function getProtocol()
53 53
     {
54 54
         return $this->protocol;
55 55
     }
@@ -57,15 +57,15 @@  discard block
 block discarded – undo
57 57
     /**
58 58
      *
59 59
      */
60
-    private function parseContentProtocol ()
60
+    private function parseContentProtocol()
61 61
     {
62
-        if ( $this->hasEnabled ( 'file_content' ) )
62
+        if ($this->hasEnabled('file_content'))
63 63
         {
64 64
             $this->protocol = 'file_content';
65
-        } elseif ( $this->hasEnabled ( 'steam_content' ) )
65
+        } elseif ($this->hasEnabled('steam_content'))
66 66
         {
67 67
             $this->protocol = 'steam_content';
68
-        } elseif ( $this->hasEnabled ( 'curl' ) )
68
+        } elseif ($this->hasEnabled('curl'))
69 69
         {
70 70
             $this->protocol = 'curl';
71 71
         }
@@ -74,18 +74,18 @@  discard block
 block discarded – undo
74 74
     /**
75 75
      * @return bool
76 76
      */
77
-    private function hasEnabled ( $type )
77
+    private function hasEnabled($type)
78 78
     {
79
-        switch ( $type )
79
+        switch ($type)
80 80
         {
81 81
             case 'curl':
82
-                return function_exists ( 'fopen' ) && function_exists ( 'curl_exec' );
82
+                return function_exists('fopen') && function_exists('curl_exec');
83 83
                 break;
84 84
             case 'file_content':
85
-                return function_exists ( 'file_get_contents' ) && function_exists ( 'stream_get_contents' );
85
+                return function_exists('file_get_contents') && function_exists('stream_get_contents');
86 86
                 break;
87 87
             case 'steam_content':
88
-                return function_exists ( 'fopen' ) && function_exists ( 'stream_get_contents' );
88
+                return function_exists('fopen') && function_exists('stream_get_contents');
89 89
                 break;
90 90
         }
91 91
 
Please login to merge, or discard this patch.
build/Classes/Update.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -38,9 +38,9 @@
 block discarded – undo
38 38
 
39 39
         $this->versionUpdate = $version;
40 40
         $this->tempFileName = self::$fileName
41
-                              . self::$separador
42
-                              . $this->versionUpdate
43
-                              . self::$extencion;
41
+                                . self::$separador
42
+                                . $this->versionUpdate
43
+                                . self::$extencion;
44 44
 
45 45
     }
46 46
 
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -28,12 +28,12 @@  discard block
 block discarded – undo
28 28
      */
29 29
     private $objGitHub;
30 30
 
31
-    public function __construct ( $version = null )
31
+    public function __construct($version = null)
32 32
     {
33
-        $this->objGitHub = GitHub::getInstance ();
34
-        if ( is_null ( $version ) )
33
+        $this->objGitHub = GitHub::getInstance();
34
+        if (is_null($version))
35 35
         {
36
-            $version = $this->objGitHub->getLastVersion ();
36
+            $version = $this->objGitHub->getLastVersion();
37 37
         }
38 38
 
39 39
         $this->versionUpdate = $version;
@@ -44,59 +44,59 @@  discard block
 block discarded – undo
44 44
 
45 45
     }
46 46
 
47
-    public function update ()
47
+    public function update()
48 48
     {
49
-        if ( Version::HasNewVersion () && ! Version::equalVersion ( $this->versionUpdate )
49
+        if (Version::HasNewVersion() && ! Version::equalVersion($this->versionUpdate)
50 50
         )
51 51
         {
52
-            $content = $this->objGitHub->getContent ( $this->objGitHub->getLastPhar () , true );
53
-            if ( $content )
52
+            $content = $this->objGitHub->getContent($this->objGitHub->getLastPhar(), true);
53
+            if ($content)
54 54
             {
55
-                $this->objGitHub->putContent ( $this->tempFileName , $content );
55
+                $this->objGitHub->putContent($this->tempFileName, $content);
56 56
             }
57 57
         } else
58 58
         {
59
-            printf ( "esta versão é a atual\n" );
59
+            printf("esta versão é a atual\n");
60 60
         }
61 61
 
62 62
         return $this;
63 63
     }
64 64
 
65
-    public function downloadVersion ( $version )
65
+    public function downloadVersion($version)
66 66
     {
67
-        if ( Version::existVersion ( $version )
68
-             && ! Version::equalVersion ( $this->versionUpdate )
67
+        if (Version::existVersion($version)
68
+             && ! Version::equalVersion($this->versionUpdate)
69 69
         )
70 70
         {
71
-            $content = $this->objGitHub->getContent ( $this->objGitHub->getPharByVersion ( $version ) , true );
72
-            if ( $content )
71
+            $content = $this->objGitHub->getContent($this->objGitHub->getPharByVersion($version), true);
72
+            if ($content)
73 73
             {
74
-                $this->objGitHub->putContent ( $this->tempFileName , $content );
74
+                $this->objGitHub->putContent($this->tempFileName, $content);
75 75
             }
76 76
         } else
77 77
         {
78
-            if ( ! Version::existVersion ( $version ) )
78
+            if ( ! Version::existVersion($version))
79 79
             {
80
-                throw new \Exception ( "\033[0;31mError: Esta versão não existe\033[0m\n" );
80
+                throw new \Exception("\033[0;31mError: Esta versão não existe\033[0m\n");
81 81
             }
82
-            throw new \Exception ( "\033[0;31mError: Esta versão é a atual\033[0m\n" );
82
+            throw new \Exception("\033[0;31mError: Esta versão é a atual\033[0m\n");
83 83
         }
84 84
 
85 85
         return $this;
86 86
     }
87 87
 
88
-    public function modifyTempName ()
88
+    public function modifyTempName()
89 89
     {
90
-        if ( file_exists ( realpath ( $this->tempFileName ) ) )
90
+        if (file_exists(realpath($this->tempFileName)))
91 91
         {
92
-            $fileName = realpath ( self::$fileName . self::$extencion );
93
-            if ( file_exists ( $fileName ) )
92
+            $fileName = realpath(self::$fileName . self::$extencion);
93
+            if (file_exists($fileName))
94 94
             {
95
-                unlink ( $fileName );
95
+                unlink($fileName);
96 96
             }
97 97
 
98
-            chmod ( $this->tempFileName , 0777 );
99
-            rename ( $this->tempFileName , self::$fileName . self::$extencion );
98
+            chmod($this->tempFileName, 0777);
99
+            rename($this->tempFileName, self::$fileName . self::$extencion);
100 100
 
101 101
         }
102 102
 
Please login to merge, or discard this patch.
build/Classes/Update/ProgressBar.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@
 block discarded – undo
79 79
             {
80 80
                 $length = $this->getProgress ();
81 81
                 printf ( "\r[%-100s] %d%%" , str_repeat ( "=" , $length )
82
-                                             . ">" , $length );
82
+                                                . ">" , $length );
83 83
             }
84 84
         }
85 85
 
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -14,14 +14,14 @@  discard block
 block discarded – undo
14 14
 
15 15
     private $progresslength = 0;
16 16
 
17
-    private function __construct (){ }
17
+    private function __construct() { }
18 18
 
19 19
     /**
20 20
      * @return \Classes\Update\ProgressBar
21 21
      */
22
-    public static function getInstance ()
22
+    public static function getInstance()
23 23
     {
24
-        if ( is_null ( self::$progressBar ) )
24
+        if (is_null(self::$progressBar))
25 25
         {
26 26
             self::$progressBar = new ProgressBar();
27 27
         }
@@ -29,38 +29,38 @@  discard block
 block discarded – undo
29 29
         return self::$progressBar;
30 30
     }
31 31
 
32
-    public function setMaxByte ( $bytesMax )
32
+    public function setMaxByte($bytesMax)
33 33
     {
34 34
         $this->max = $bytesMax;
35 35
 
36 36
         return $this;
37 37
     }
38 38
 
39
-    public function setProgress ( $progress )
39
+    public function setProgress($progress)
40 40
     {
41 41
         $this->progress = $progress;
42
-        $this->calcule ();
42
+        $this->calcule();
43 43
 
44 44
         return $this;
45 45
     }
46 46
 
47
-    public function getProgress ()
47
+    public function getProgress()
48 48
     {
49 49
         return $this->progresslength;
50 50
     }
51 51
 
52
-    public function calcule ()
52
+    public function calcule()
53 53
     {
54
-        if ( $this->progress > 0 )
54
+        if ($this->progress > 0)
55 55
         {
56
-            $this->progresslength = round( $this->progress * 100 / $this->max );
56
+            $this->progresslength = round($this->progress * 100 / $this->max);
57 57
             //$this->progresslength = (int) ( ( $this->progress / $this->max ) * 100 );
58 58
         }
59 59
     }
60 60
 
61
-    public function finish ()
61
+    public function finish()
62 62
     {
63
-        if ( $this->getProgress () >= 99 && !self::$finished)
63
+        if ($this->getProgress() >= 99 && ! self::$finished)
64 64
         {
65 65
             echo "\n\033[1;32mDone!\033[0m\n";
66 66
             self::$finished = 1;
@@ -68,25 +68,25 @@  discard block
 block discarded – undo
68 68
 
69 69
     }
70 70
 
71
-    public function render ()
71
+    public function render()
72 72
     {
73
-        if ( $this->progress > 0 && !self::$finished)
73
+        if ($this->progress > 0 && ! self::$finished)
74 74
         {
75
-            if ( ! isset( $this->max ) )
75
+            if ( ! isset($this->max))
76 76
             {
77
-                printf ( "\rUnknown filesize.. %2d kb done.." , $this->progress / 1024 );
77
+                printf("\rUnknown filesize.. %2d kb done..", $this->progress / 1024);
78 78
             } else
79 79
             {
80
-                $length = $this->getProgress ();
81
-                printf ( "\r[%-100s] %d%%" , str_repeat ( "=" , $length )
82
-                                             . ">" , $length );
80
+                $length = $this->getProgress();
81
+                printf("\r[%-100s] %d%%", str_repeat("=", $length)
82
+                                             . ">", $length);
83 83
             }
84 84
         }
85 85
 
86 86
         return $this;
87 87
     }
88 88
 
89
-    public function clear ()
89
+    public function clear()
90 90
     {
91 91
         $this->max = 0;
92 92
         $this->progress = 0;
Please login to merge, or discard this patch.
build/Classes/Update/Content/GitHub.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -13,28 +13,28 @@  discard block
 block discarded – undo
13 13
 class GitHub extends AbstractContent
14 14
 {
15 15
     private static $tagsGithub  = "https://api.github.com/repos/pedro151/orm-generator/tags";
16
-    private static $listVersion = array ();
16
+    private static $listVersion = array();
17 17
     private        $phar        = "https://raw.githubusercontent.com/pedro151/orm-generator/%s/bin/orm-generator.phar";
18 18
     //private        $phar        = "https://github.com/pedro151/orm-generator/blob/%s/bin/orm-generator.phar?raw=true";
19 19
 
20 20
     /**
21 21
      * @return mixed
22 22
      */
23
-    public function getInfo ()
23
+    public function getInfo()
24 24
     {
25
-        return json_decode ( $this->getContent ( self::$tagsGithub ) );
25
+        return json_decode($this->getContent(self::$tagsGithub));
26 26
     }
27 27
 
28 28
     /**
29 29
      *
30 30
      */
31
-    protected function init ()
31
+    protected function init()
32 32
     {
33
-        if ( is_array ( $this->getInfo () ) )
33
+        if (is_array($this->getInfo()))
34 34
         {
35
-            foreach ( $this->getInfo () as $index => $objTag )
35
+            foreach ($this->getInfo() as $index => $objTag)
36 36
             {
37
-                self::$listVersion[ preg_replace ( "/[^0-9.]/" , "" , $objTag->name ) ] = sprintf ( $this->phar , $objTag->name );
37
+                self::$listVersion[preg_replace("/[^0-9.]/", "", $objTag->name)] = sprintf($this->phar, $objTag->name);
38 38
             }
39 39
         }
40 40
     }
@@ -42,19 +42,19 @@  discard block
 block discarded – undo
42 42
     /**
43 43
      * @return mixed
44 44
      */
45
-    public function getLastVersion ()
45
+    public function getLastVersion()
46 46
     {
47
-        return current ( array_keys ( self::$listVersion ) );
47
+        return current(array_keys(self::$listVersion));
48 48
     }
49 49
 
50 50
     /**
51 51
      * @return mixed
52 52
      */
53
-    public function getLastPhar ()
53
+    public function getLastPhar()
54 54
     {
55
-        reset ( self::$listVersion );
55
+        reset(self::$listVersion);
56 56
 
57
-        return current ( self::$listVersion );
57
+        return current(self::$listVersion);
58 58
     }
59 59
 
60 60
     /**
@@ -62,14 +62,14 @@  discard block
 block discarded – undo
62 62
      *
63 63
      * @return mixed
64 64
      */
65
-    public function getPharByVersion ( $version )
65
+    public function getPharByVersion($version)
66 66
     {
67
-        return self::$listVersion[ $version ];
67
+        return self::$listVersion[$version];
68 68
     }
69 69
 
70
-    public function hasPharByVersion ( $version )
70
+    public function hasPharByVersion($version)
71 71
     {
72
-        return isset( self::$listVersion[ $version ] );
72
+        return isset(self::$listVersion[$version]);
73 73
     }
74 74
 
75 75
 }
76 76
\ No newline at end of file
Please login to merge, or discard this patch.
build/Classes/Update/Version.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
         if ( self::HasNewVersion () )
39 39
         {
40 40
             return "\033[0;31mThere is a new version " . self::$lastVersion
41
-                   . " available\033[0m \n";
41
+                    . " available\033[0m \n";
42 42
         }
43 43
     }
44 44
 
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
     /**
16 16
      * @return string
17 17
      */
18
-    public static function getVersion ()
18
+    public static function getVersion()
19 19
     {
20 20
         return static::$_currentVersion;
21 21
     }
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
     /**
24 24
      * @return bool
25 25
      */
26
-    public static function HasNewVersion ()
26
+    public static function HasNewVersion()
27 27
     {
28
-        self::$lastVersion = GitHub::getInstance ()->getLastVersion ();
28
+        self::$lastVersion = GitHub::getInstance()->getLastVersion();
29 29
 
30 30
         return self::$lastVersion > static::$_currentVersion;
31 31
     }
@@ -33,9 +33,9 @@  discard block
 block discarded – undo
33 33
     /**
34 34
      * @return string
35 35
      */
36
-    public function messageHasNewVersion ()
36
+    public function messageHasNewVersion()
37 37
     {
38
-        if ( self::HasNewVersion () )
38
+        if (self::HasNewVersion())
39 39
         {
40 40
             return "\033[0;31mThere is a new version " . self::$lastVersion
41 41
                    . " available\033[0m \n";
@@ -47,14 +47,14 @@  discard block
 block discarded – undo
47 47
      *
48 48
      * @return bool
49 49
      */
50
-    public static function equalVersion ( $version )
50
+    public static function equalVersion($version)
51 51
     {
52
-        return $version === self::getVersion ();
52
+        return $version === self::getVersion();
53 53
     }
54 54
 
55
-    public static function existVersion ( $version )
55
+    public static function existVersion($version)
56 56
     {
57
-        return GitHub::getInstance ()->hasPharByVersion ( $version );
57
+        return GitHub::getInstance()->hasPharByVersion($version);
58 58
     }
59 59
 
60 60
 }
61 61
\ No newline at end of file
Please login to merge, or discard this patch.
build/Classes/MakerFile.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
         foreach ( $arrFoldersName as $index => $folderName )
101 101
         {
102 102
             $arrFoldersName[ $index ] = $this->getConfig ()
103
-                                             ->replaceReservedWord ( $folderName );
103
+                                                ->replaceReservedWord ( $folderName );
104 104
         }
105 105
 
106 106
         return implode ( DIRECTORY_SEPARATOR , array_filter ( $arrFoldersName ) );
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
                 $folderName ,
158 158
                 $this->getClassName (
159 159
                     $this->getConfig ()
160
-                         ->getDatabase ()
160
+                            ->getDatabase ()
161 161
                 )
162 162
             );
163 163
             $this->location = array ( $this->filterLocation ( $url ) );
Please login to merge, or discard this patch.
Spacing   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     /**
23 23
      * @type string[]
24 24
      */
25
-    public $location = array ();
25
+    public $location = array();
26 26
 
27 27
     /**
28 28
      * caminho de pastas Base
@@ -46,46 +46,46 @@  discard block
 block discarded – undo
46 46
 
47 47
     private $msgReservedWord = "\033[0mPlease enter the value for reserved word \033[0;31m'%index%' \033[1;33m[%config%]:\033[0m ";
48 48
 
49
-    public function __construct ( Config $config )
49
+    public function __construct(Config $config)
50 50
     {
51
-        $this->config = $config->getAdapterConfig ();
52
-        $this->parseReservedWord ( $this->getConfig () );
53
-        $this->driver = $config->getAdapterDriver ( $this->getConfig () );
54
-        $this->parseLocation ( $config->_basePath );
51
+        $this->config = $config->getAdapterConfig();
52
+        $this->parseReservedWord($this->getConfig());
53
+        $this->driver = $config->getAdapterDriver($this->getConfig());
54
+        $this->parseLocation($config->_basePath);
55 55
     }
56 56
 
57 57
     /**
58 58
      * @param AdapterConfig\AbstractAdapter $config
59 59
      */
60
-    public function parseReservedWord ( AdapterConfig\AbstractAdapter $config )
60
+    public function parseReservedWord(AdapterConfig\AbstractAdapter $config)
61 61
     {
62 62
         $palavrasReservadas = $config->reservedWord;
63
-        if ( ! $palavrasReservadas )
63
+        if ( ! $palavrasReservadas)
64 64
         {
65 65
             return;
66 66
         }
67 67
 
68
-        $schema = $config->getSchemas ();
69
-        $db = $config->getDatabase ();
70
-        $hasSchema = array_intersect ( $schema , array_flip ( $palavrasReservadas ) );
71
-        $hasDatabase = in_array ( $db , $palavrasReservadas );
72
-        if ( ! ( $hasSchema or $hasDatabase ) )
68
+        $schema = $config->getSchemas();
69
+        $db = $config->getDatabase();
70
+        $hasSchema = array_intersect($schema, array_flip($palavrasReservadas));
71
+        $hasDatabase = in_array($db, $palavrasReservadas);
72
+        if ( ! ($hasSchema or $hasDatabase))
73 73
         {
74 74
             return;
75 75
         }
76 76
 
77 77
         echo "- database has reserved words\n";
78
-        foreach ( $palavrasReservadas as $index => $config )
78
+        foreach ($palavrasReservadas as $index => $config)
79 79
         {
80
-            $attribs = array (
81
-                "%index%"  => $index ,
80
+            $attribs = array(
81
+                "%index%"  => $index,
82 82
                 "%config%" => $config
83 83
             );
84
-            echo strtr ( $this->msgReservedWord , $attribs );
85
-            $line = trim ( fgets ( STDIN ) );
86
-            if ( ! empty( $line ) )
84
+            echo strtr($this->msgReservedWord, $attribs);
85
+            $line = trim(fgets(STDIN));
86
+            if ( ! empty($line))
87 87
             {
88
-                $this->getConfig ()->reservedWord[ $index ] = $line;
88
+                $this->getConfig()->reservedWord[$index] = $line;
89 89
             }
90 90
         }
91 91
     }
@@ -95,199 +95,199 @@  discard block
 block discarded – undo
95 95
      *
96 96
      * @return string
97 97
      */
98
-    private function filterLocation ( $arrFoldersName )
98
+    private function filterLocation($arrFoldersName)
99 99
     {
100
-        foreach ( $arrFoldersName as $index => $folderName )
100
+        foreach ($arrFoldersName as $index => $folderName)
101 101
         {
102
-            $arrFoldersName[ $index ] = $this->getConfig ()
103
-                                             ->replaceReservedWord ( $folderName );
102
+            $arrFoldersName[$index] = $this->getConfig()
103
+                                             ->replaceReservedWord($folderName);
104 104
         }
105 105
 
106
-        return implode ( DIRECTORY_SEPARATOR , array_filter ( $arrFoldersName ) );
106
+        return implode(DIRECTORY_SEPARATOR, array_filter($arrFoldersName));
107 107
     }
108 108
 
109 109
     /**
110 110
      * Analisa os caminhos das pastas base
111 111
      */
112
-    public function parseLocation ( $basePath )
112
+    public function parseLocation($basePath)
113 113
     {
114 114
 
115
-        $arrBase = array (
116
-            $basePath ,
115
+        $arrBase = array(
116
+            $basePath,
117 117
             $this->config->path
118 118
         );
119 119
 
120
-        $this->baseLocation = $this->filterLocation ( $arrBase );
120
+        $this->baseLocation = $this->filterLocation($arrBase);
121 121
 
122 122
         # pasta com nome do driver do banco
123 123
         $driverBase = '';
124
-        if ( (bool) @$this->config->{"folder-database"} )
124
+        if ((bool) @$this->config->{"folder-database"} )
125 125
         {
126
-            $classDriver = explode ( '\\' , get_class ( $this->driver ) );
127
-            $driverBase = end ( $classDriver );
126
+            $classDriver = explode('\\', get_class($this->driver));
127
+            $driverBase = end($classDriver);
128 128
         }
129 129
         $folderName = '';
130
-        if ( (bool) @$this->config->{"folder-name"} )
130
+        if ((bool) @$this->config->{"folder-name"} )
131 131
         {
132
-            $folderName = $this->getClassName ( trim ( $this->config->{"folder-name"} ) );
132
+            $folderName = $this->getClassName(trim($this->config->{"folder-name"} ));
133 133
         }
134 134
 
135
-        if ( $this->config->hasSchemas () )
135
+        if ($this->config->hasSchemas())
136 136
         {
137 137
 
138
-            $schemas = $this->config->getSchemas ();
139
-            foreach ( $schemas as $schema )
138
+            $schemas = $this->config->getSchemas();
139
+            foreach ($schemas as $schema)
140 140
             {
141
-                $arrUrl = array (
142
-                    $this->baseLocation ,
143
-                    $driverBase ,
144
-                    $folderName ,
145
-                    $this->getClassName ( $schema )
141
+                $arrUrl = array(
142
+                    $this->baseLocation,
143
+                    $driverBase,
144
+                    $folderName,
145
+                    $this->getClassName($schema)
146 146
                 );
147 147
 
148
-                $this->location[ $schema ] = $this->filterLocation ( $arrUrl );
149
-                unset( $arrUrl );
148
+                $this->location[$schema] = $this->filterLocation($arrUrl);
149
+                unset($arrUrl);
150 150
             }
151 151
 
152 152
         } else
153 153
         {
154
-            $url = array (
155
-                $this->baseLocation ,
156
-                $driverBase ,
157
-                $folderName ,
158
-                $this->getClassName (
159
-                    $this->getConfig ()
160
-                         ->getDatabase ()
154
+            $url = array(
155
+                $this->baseLocation,
156
+                $driverBase,
157
+                $folderName,
158
+                $this->getClassName(
159
+                    $this->getConfig()
160
+                         ->getDatabase()
161 161
                 )
162 162
             );
163
-            $this->location = array ( $this->filterLocation ( $url ) );
164
-            unset( $url );
163
+            $this->location = array($this->filterLocation($url));
164
+            unset($url);
165 165
         }
166 166
     }
167 167
 
168 168
     /**
169 169
      * @return AdapterConfig\AbstractAdapter
170 170
      */
171
-    public function getConfig ()
171
+    public function getConfig()
172 172
     {
173 173
         return $this->config;
174 174
     }
175 175
 
176 176
     /* Get current time */
177
-    public function startTime ()
177
+    public function startTime()
178 178
     {
179 179
         echo "\033[1;32mStarting..\033[0m\n";
180
-        $this->startTime = microtime ( true );
180
+        $this->startTime = microtime(true);
181 181
     }
182 182
 
183
-    private function getRunTime ()
183
+    private function getRunTime()
184 184
     {
185
-        return round ( ( microtime ( true ) - $this->startTime ) , 3 );
185
+        return round((microtime(true) - $this->startTime), 3);
186 186
     }
187 187
 
188 188
     /**
189 189
      * @param $objMakeFile
190 190
      */
191
-    private function generateFilesFixed ( FilesFixeds $objFilesFixeds )
191
+    private function generateFilesFixed(FilesFixeds $objFilesFixeds)
192 192
     {
193
-        if ( $objFilesFixeds->hasData () )
193
+        if ($objFilesFixeds->hasData())
194 194
         {
195 195
             $file = $this->baseLocation
196 196
                     . DIRECTORY_SEPARATOR
197
-                    . $objFilesFixeds->getFileName ()
197
+                    . $objFilesFixeds->getFileName()
198 198
                     . '.php';
199 199
 
200
-            $tpl = $this->getParsedTplContents ( $objFilesFixeds->getTpl () );
201
-            self::makeSourcer ( $file , $tpl , true );
200
+            $tpl = $this->getParsedTplContents($objFilesFixeds->getTpl());
201
+            self::makeSourcer($file, $tpl, true);
202 202
         }
203 203
     }
204 204
 
205 205
     /**
206 206
      * Executa o Make, criando arquivos e Diretorios
207 207
      */
208
-    public function run ()
208
+    public function run()
209 209
     {
210 210
         $cur = 0;
211 211
         $numFilesCreated = 0;
212 212
         $numFilesIgnored = 0;
213 213
 
214
-        $this->startTime ();
215
-        $this->waitOfDatabase ( $cur );
214
+        $this->startTime();
215
+        $this->waitOfDatabase($cur);
216 216
 
217
-        $this->max = $this->driver->getTotalTables () * $this->countDiretory ();
218
-        $progressBar = ProgressBar::getInstance ()->setMaxByte ( $this->max );
217
+        $this->max = $this->driver->getTotalTables() * $this->countDiretory();
218
+        $progressBar = ProgressBar::getInstance()->setMaxByte($this->max);
219 219
 
220
-        foreach ( $this->location as $schema => $location )
220
+        foreach ($this->location as $schema => $location)
221 221
         {
222
-            foreach ( $this->factoryMakerFile () as $objMakeFile )
222
+            foreach ($this->factoryMakerFile() as $objMakeFile)
223 223
             {
224
-                $path = $location . DIRECTORY_SEPARATOR . $objMakeFile->getPastName ();
225
-                if ( $this->config->isCleanTrash () )
224
+                $path = $location . DIRECTORY_SEPARATOR . $objMakeFile->getPastName();
225
+                if ($this->config->isCleanTrash())
226 226
                 {
227
-                    CleanTrash::getInstance ()->run ( $path , $this->driver , $schema );
227
+                    CleanTrash::getInstance()->run($path, $this->driver, $schema);
228 228
                 }
229
-                self::makeDir ( $path );
229
+                self::makeDir($path);
230 230
 
231 231
                 #Cria as Classes de Exceção e Abstratas
232
-                foreach ( $objMakeFile->getListFilesFixed () as $nameObject )
232
+                foreach ($objMakeFile->getListFilesFixed() as $nameObject)
233 233
                 {
234
-                    $this->generateFilesFixed ( $objMakeFile->getFilesFixeds ( $nameObject ) );
234
+                    $this->generateFilesFixed($objMakeFile->getFilesFixeds($nameObject));
235 235
                 }
236 236
 
237 237
                 #Cria as Classes do Banco
238
-                foreach ( $this->driver->getTables ( $schema ) as $key => $objTables )
238
+                foreach ($this->driver->getTables($schema) as $key => $objTables)
239 239
                 {
240 240
                     $file = $path . DIRECTORY_SEPARATOR
241
-                            . self::getClassName ( $objTables->getName () ) . '.php';
241
+                            . self::getClassName($objTables->getName()) . '.php';
242 242
 
243
-                    $tpl = $this->getParsedTplContents (
244
-                        $objMakeFile->getFileTpl () ,
245
-                        $objMakeFile->parseRelation ( $this , $objTables ) ,
246
-                        $objTables ,
243
+                    $tpl = $this->getParsedTplContents(
244
+                        $objMakeFile->getFileTpl(),
245
+                        $objMakeFile->parseRelation($this, $objTables),
246
+                        $objTables,
247 247
                         $objMakeFile
248 248
 
249 249
                     );
250
-                    if ( self::makeSourcer ( $file , $tpl , $objMakeFile->isOverwrite () ) )
250
+                    if (self::makeSourcer($file, $tpl, $objMakeFile->isOverwrite()))
251 251
                     {
252
-                        ++ $numFilesCreated;
252
+                        ++$numFilesCreated;
253 253
                     } else
254 254
                     {
255
-                        ++ $numFilesIgnored;
255
+                        ++$numFilesIgnored;
256 256
                     }
257 257
 
258 258
                     ++$cur;
259
-                    $progressBar->setProgress ( $cur )->render();
259
+                    $progressBar->setProgress($cur)->render();
260 260
                 }
261 261
             }
262 262
         }
263 263
 
264
-        $this->reportProcess ( $numFilesCreated , $numFilesIgnored );
264
+        $this->reportProcess($numFilesCreated, $numFilesIgnored);
265 265
         $progressBar->finish();
266 266
     }
267 267
 
268
-    private function waitOfDatabase ( &$cur )
268
+    private function waitOfDatabase(&$cur)
269 269
     {
270
-        printf ( "\033[1;33mWait, the database is being analyzed..\033[0m\n" );
271
-        $this->driver->runDatabase ();
270
+        printf("\033[1;33mWait, the database is being analyzed..\033[0m\n");
271
+        $this->driver->runDatabase();
272 272
     }
273 273
 
274
-    private function reportProcess ( $numFilesCreated = 0 , $numFilesIgnored = 0 )
274
+    private function reportProcess($numFilesCreated = 0, $numFilesIgnored = 0)
275 275
     {
276
-        if ( $this->config->isStatusEnabled () )
276
+        if ($this->config->isStatusEnabled())
277 277
         {
278
-            $databases = count ( $this->location );
279
-            $countDir = $this->countDiretory ();
280
-            $totalTable = $this->driver->getTotalTables ();
278
+            $databases = count($this->location);
279
+            $countDir = $this->countDiretory();
280
+            $totalTable = $this->driver->getTotalTables();
281 281
             $totalFiles = $numFilesIgnored + $numFilesCreated;
282
-            $totalFilesDeleted = CleanTrash::getInstance ()->getNumFilesDeleted ();
282
+            $totalFilesDeleted = CleanTrash::getInstance()->getNumFilesDeleted();
283 283
             echo "\n------";
284
-            printf ( "\n\r-Files generated/updated: \033[1;33m%s\033[0m" , $numFilesCreated );
285
-            printf ( "\n\r-Files not upgradeable: \033[1;33m%s\033[0m" , $numFilesIgnored );
286
-            printf ( "\n\r-Files deleted: \033[1;33m%s\033[0m" , $totalFilesDeleted );
287
-            printf ( "\n\r-Total files analyzed: \033[1;33m%s of %s\033[0m" , $totalFiles , $this->max );
288
-            printf ( "\n\r-Diretories: \033[1;33m%s\033[0m" , $databases * $countDir );
289
-            printf ( "\n\r-Scanned tables: \033[1;33m%s\033[0m" , $totalTable );
290
-            printf ( "\n\r-Execution time: \033[1;33m%ssec\033[0m" , $this->getRunTime () );
284
+            printf("\n\r-Files generated/updated: \033[1;33m%s\033[0m", $numFilesCreated);
285
+            printf("\n\r-Files not upgradeable: \033[1;33m%s\033[0m", $numFilesIgnored);
286
+            printf("\n\r-Files deleted: \033[1;33m%s\033[0m", $totalFilesDeleted);
287
+            printf("\n\r-Total files analyzed: \033[1;33m%s of %s\033[0m", $totalFiles, $this->max);
288
+            printf("\n\r-Diretories: \033[1;33m%s\033[0m", $databases * $countDir);
289
+            printf("\n\r-Scanned tables: \033[1;33m%s\033[0m", $totalTable);
290
+            printf("\n\r-Execution time: \033[1;33m%ssec\033[0m", $this->getRunTime());
291 291
             echo "\n------";
292 292
         }
293 293
     }
@@ -297,9 +297,9 @@  discard block
 block discarded – undo
297 297
      *
298 298
      * @return AbstractAdapter[]
299 299
      */
300
-    public function factoryMakerFile ()
300
+    public function factoryMakerFile()
301 301
     {
302
-        return $this->config->getMakeFileInstances ();
302
+        return $this->config->getMakeFileInstances();
303 303
     }
304 304
 
305 305
     /**
@@ -307,16 +307,16 @@  discard block
 block discarded – undo
307 307
      *
308 308
      * @return int
309 309
      */
310
-    public function countDiretory ()
310
+    public function countDiretory()
311 311
     {
312
-        if ( null === $this->countDir )
312
+        if (null === $this->countDir)
313 313
         {
314 314
             $this->countDir = 1;
315
-            foreach ( $this->factoryMakerFile () as $abstractAdapter )
315
+            foreach ($this->factoryMakerFile() as $abstractAdapter)
316 316
             {
317
-                if ( $abstractAdapter->hasDiretory () )
317
+                if ($abstractAdapter->hasDiretory())
318 318
                 {
319
-                    ++ $this->countDir;
319
+                    ++$this->countDir;
320 320
                 }
321 321
             }
322 322
         }
@@ -332,25 +332,25 @@  discard block
 block discarded – undo
332 332
      *
333 333
      * @return String
334 334
      */
335
-    protected function getParsedTplContents (
336
-        $tplFile , $vars = array () , \Classes\Db\DbTable $objTables = null ,
335
+    protected function getParsedTplContents(
336
+        $tplFile, $vars = array(), \Classes\Db\DbTable $objTables = null,
337 337
         $objMakeFile = null
338
-    ){
338
+    ) {
339 339
 
340
-        $arrUrl = array (
341
-            __DIR__ ,
342
-            'templates' ,
343
-            $this->config->framework ,
340
+        $arrUrl = array(
341
+            __DIR__,
342
+            'templates',
343
+            $this->config->framework,
344 344
             $tplFile
345 345
         );
346 346
 
347
-        $filePath = implode ( DIRECTORY_SEPARATOR , filter_var_array ( $arrUrl ) );
347
+        $filePath = implode(DIRECTORY_SEPARATOR, filter_var_array($arrUrl));
348 348
 
349
-        extract ( $vars );
350
-        ob_start ();
349
+        extract($vars);
350
+        ob_start();
351 351
         require $filePath;
352
-        $data = ob_get_contents ();
353
-        ob_end_clean ();
352
+        $data = ob_get_contents();
353
+        ob_end_clean();
354 354
 
355 355
         return $data;
356 356
     }
Please login to merge, or discard this patch.
build/Classes/Config.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -160,14 +160,14 @@  discard block
 block discarded – undo
160 160
     {
161 161
         $update = new Update();
162 162
         $update->update ()
163
-               ->modifyTempName ();
163
+                ->modifyTempName ();
164 164
     }
165 165
 
166 166
     public function download ( $version )
167 167
     {
168 168
         $update = new Update();
169 169
         $update->downloadVersion ( $version )
170
-               ->modifyTempName ();
170
+                ->modifyTempName ();
171 171
     }
172 172
 
173 173
     public function getVersion ()
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
         $configIni = isset( $argv[ 'name-ini' ] )
194 194
             ? $argv[ 'name-ini' ]
195 195
             : $this->_basePath
196
-              . $this->configIniDefault;
196
+                . $this->configIniDefault;
197 197
 
198 198
         $configTemp = $this->loadIniFile ( realpath ( $configIni ) );
199 199
         $configCurrent = self::parseConfigEnv ( $configTemp , $argv );
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
         {
208 208
             $frameworks = implode ( "\n\t" , $this->frameworkList );
209 209
             throw new \Exception( "list of frameworks: \n\t\033[1;33m" . $frameworks
210
-                                  . "\n\033[0m" );
210
+                                    . "\n\033[0m" );
211 211
         }
212 212
 
213 213
         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
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     /**
56 56
      * @var array
57 57
      */
58
-    private $argv = array ();
58
+    private $argv = array();
59 59
 
60 60
     /**
61 61
      * @var \Classes\AdapterConfig\AbstractAdapter
@@ -67,56 +67,56 @@  discard block
 block discarded – undo
67 67
      */
68 68
     private $adapterDriver;
69 69
 
70
-    private $frameworkList = array (
71
-        'none' ,
72
-        'zf1' ,
70
+    private $frameworkList = array(
71
+        'none',
72
+        'zf1',
73 73
         'phalcon'
74 74
     );
75 75
 
76
-    private $parameterList = array (
77
-        'init'        => 'Creates the necessary configuration file to start using the orm-generator.' ,
78
-        'name-ini'  => 'reference to another .ini file configuration (relative path).' ,
79
-        'config-env'  => 'orm-generator configuration environment.' ,
80
-        'framework'   => 'name framework used, which has the contents of the database configurations and framework template.' ,
81
-        'driver'      => 'database driver name (Ex.: pgsql).' ,
82
-        'database'    => 'database name.' ,
83
-        'schema'      => 'database schema name (one or more than one).' ,
84
-        'tables'      => 'table name (parameter can be used more then once).' ,
85
-        'clean-trash' => 'delete all files that do not belong to your Database due' ,
86
-        'status'      => 'show status of implementation carried out after completing the process.' ,
87
-        'version'     => 'shows the version of orm-generator.' ,
88
-        'help'        => "help command explaining all the options and manner of use." ,
89
-        'path'        => "specify where to create the files (default is current directory)." ,
76
+    private $parameterList = array(
77
+        'init'        => 'Creates the necessary configuration file to start using the orm-generator.',
78
+        'name-ini'  => 'reference to another .ini file configuration (relative path).',
79
+        'config-env'  => 'orm-generator configuration environment.',
80
+        'framework'   => 'name framework used, which has the contents of the database configurations and framework template.',
81
+        'driver'      => 'database driver name (Ex.: pgsql).',
82
+        'database'    => 'database name.',
83
+        'schema'      => 'database schema name (one or more than one).',
84
+        'tables'      => 'table name (parameter can be used more then once).',
85
+        'clean-trash' => 'delete all files that do not belong to your Database due',
86
+        'status'      => 'show status of implementation carried out after completing the process.',
87
+        'version'     => 'shows the version of orm-generator.',
88
+        'help'        => "help command explaining all the options and manner of use.",
89
+        'path'        => "specify where to create the files (default is current directory).",
90 90
         'update'      => ".",
91 91
         'download'    => ""
92 92
     );
93 93
 
94
-    public function __construct ( $argv , $basePath , $numArgs )
94
+    public function __construct($argv, $basePath, $numArgs)
95 95
     {
96
-        if ( array_key_exists ( 'help' , $argv ) or ( $numArgs > 1
97
-                                                      && count ( $argv ) < 1 )
96
+        if (array_key_exists('help', $argv) or ($numArgs > 1
97
+                                                      && count($argv) < 1)
98 98
         )
99 99
         {
100
-            die ( $this->getUsage () );
100
+            die ($this->getUsage());
101 101
         }
102
-        if ( array_key_exists ( 'version' , $argv ) )
102
+        if (array_key_exists('version', $argv))
103 103
         {
104
-            die ( $this->getVersion () );
104
+            die ($this->getVersion());
105 105
         }
106
-        if ( array_key_exists ( 'status' , $argv ) )
106
+        if (array_key_exists('status', $argv))
107 107
         {
108
-            $argv[ 'status' ] = true;
108
+            $argv['status'] = true;
109 109
         }
110
-        if ( array_key_exists ( 'update' , $argv ) )
110
+        if (array_key_exists('update', $argv))
111 111
         {
112
-            die ( $this->update () );
112
+            die ($this->update());
113 113
         }
114
-        if ( array_key_exists ( 'download' , $argv ) )
114
+        if (array_key_exists('download', $argv))
115 115
         {
116
-            die ( $this->download ( $argv[ 'download' ] ) );
116
+            die ($this->download($argv['download']));
117 117
         }
118 118
 
119
-        $this->argv = $this->parseConfig ( $basePath , $argv );
119
+        $this->argv = $this->parseConfig($basePath, $argv);
120 120
     }
121 121
 
122 122
     /**
@@ -124,10 +124,10 @@  discard block
 block discarded – undo
124 124
      *
125 125
      * @return string
126 126
      */
127
-    public function getUsage ()
127
+    public function getUsage()
128 128
     {
129
-        $version = $this->getVersion ();
130
-        $list = $this->renderParam ();
129
+        $version = $this->getVersion();
130
+        $list = $this->renderParam();
131 131
 
132 132
         return <<<EOF
133 133
 parameters:
@@ -138,12 +138,12 @@  discard block
 block discarded – undo
138 138
 EOF;
139 139
     }
140 140
 
141
-    public function renderParam ()
141
+    public function renderParam()
142 142
     {
143 143
         $return = "";
144
-        foreach ( $this->parameterList as $param => $desc )
144
+        foreach ($this->parameterList as $param => $desc)
145 145
         {
146
-            if ( strlen ( $param ) < 5 )
146
+            if (strlen($param) < 5)
147 147
             {
148 148
                 $return .= "\t--" . $param . "\t\t: " . $desc . "\n";
149 149
             } else
@@ -156,21 +156,21 @@  discard block
 block discarded – undo
156 156
         return $return;
157 157
     }
158 158
 
159
-    public function update ()
159
+    public function update()
160 160
     {
161 161
         $update = new Update();
162
-        $update->update ()
163
-               ->modifyTempName ();
162
+        $update->update()
163
+               ->modifyTempName();
164 164
     }
165 165
 
166
-    public function download ( $version )
166
+    public function download($version)
167 167
     {
168 168
         $update = new Update();
169
-        $update->downloadVersion ( $version )
170
-               ->modifyTempName ();
169
+        $update->downloadVersion($version)
170
+               ->modifyTempName();
171 171
     }
172 172
 
173
-    public function getVersion ()
173
+    public function getVersion()
174 174
     {
175 175
         $version = new Version();
176 176
 
@@ -186,31 +186,31 @@  discard block
 block discarded – undo
186 186
      * @return array
187 187
      * @throws \Exception
188 188
      */
189
-    private function parseConfig ( $basePath , $argv )
189
+    private function parseConfig($basePath, $argv)
190 190
     {
191 191
         $this->_basePath = $basePath;
192 192
 
193
-        $configIni = isset( $argv[ 'name-ini' ] )
194
-            ? $argv[ 'name-ini' ]
193
+        $configIni = isset($argv['name-ini'])
194
+            ? $argv['name-ini']
195 195
             : $this->_basePath
196 196
               . $this->configIniDefault;
197 197
 
198
-        $configTemp = $this->loadIniFile ( realpath ( $configIni ) );
199
-        $configCurrent = self::parseConfigEnv ( $configTemp , $argv );
198
+        $configTemp = $this->loadIniFile(realpath($configIni));
199
+        $configCurrent = self::parseConfigEnv($configTemp, $argv);
200 200
 
201
-        if ( ! isset( $configCurrent[ 'framework' ] ) )
201
+        if ( ! isset($configCurrent['framework']))
202 202
         {
203
-            throw new \Exception( "configure which framework you want to use! \n" );
203
+            throw new \Exception("configure which framework you want to use! \n");
204 204
         }
205 205
 
206
-        if ( ! in_array ( $configCurrent[ 'framework' ] , $this->frameworkList ) )
206
+        if ( ! in_array($configCurrent['framework'], $this->frameworkList))
207 207
         {
208
-            $frameworks = implode ( "\n\t" , $this->frameworkList );
209
-            throw new \Exception( "list of frameworks: \n\t\033[1;33m" . $frameworks
210
-                                  . "\n\033[0m" );
208
+            $frameworks = implode("\n\t", $this->frameworkList);
209
+            throw new \Exception("list of frameworks: \n\t\033[1;33m" . $frameworks
210
+                                  . "\n\033[0m");
211 211
         }
212 212
 
213
-        return $argv + array_filter ( $configCurrent );
213
+        return $argv + array_filter($configCurrent);
214 214
     }
215 215
 
216 216
     /**
@@ -220,24 +220,24 @@  discard block
 block discarded – undo
220 220
      *
221 221
      * @return string
222 222
      */
223
-    private static function parseConfigEnv ( $configTemp , $argv )
223
+    private static function parseConfigEnv($configTemp, $argv)
224 224
     {
225
-        $thisSection = isset( $configTemp[ key ( $configTemp ) ][ 'config-env' ] )
226
-            ? $configTemp[ key (
225
+        $thisSection = isset($configTemp[key($configTemp)]['config-env'])
226
+            ? $configTemp[key(
227 227
                 $configTemp
228
-            ) ][ 'config-env' ] : null;
228
+            )]['config-env'] : null;
229 229
 
230
-        $thisSection = isset( $argv[ 'config-env' ] ) ? $argv[ 'config-env' ]
230
+        $thisSection = isset($argv['config-env']) ? $argv['config-env']
231 231
             : $thisSection;
232 232
 
233
-        if ( isset( $configTemp[ $thisSection ][ 'extends' ] ) )
233
+        if (isset($configTemp[$thisSection]['extends']))
234 234
         {
235 235
             #faz marge da config principal com a config extendida
236
-            return $configTemp[ $thisSection ]
237
-                   + $configTemp[ $configTemp[ $thisSection ][ 'extends' ] ];
236
+            return $configTemp[$thisSection]
237
+                   + $configTemp[$configTemp[$thisSection]['extends']];
238 238
         }
239 239
 
240
-        return $configTemp[ key ( $configTemp ) ];
240
+        return $configTemp[key($configTemp)];
241 241
     }
242 242
 
243 243
     /**
@@ -251,32 +251,32 @@  discard block
 block discarded – undo
251 251
      * @throws \Exception
252 252
      * @return array
253 253
      */
254
-    protected function loadIniFile ( $filename )
254
+    protected function loadIniFile($filename)
255 255
     {
256
-        if ( ! is_file ( $filename ) )
256
+        if ( ! is_file($filename))
257 257
         {
258
-            throw new \Exception( "\033[0;31mError: configuration file does not exist! \033[0m\n" );
258
+            throw new \Exception("\033[0;31mError: configuration file does not exist! \033[0m\n");
259 259
         }
260 260
 
261
-        $loaded = parse_ini_file ( $filename , true );
262
-        $iniArray = array ();
263
-        foreach ( $loaded as $key => $data )
261
+        $loaded = parse_ini_file($filename, true);
262
+        $iniArray = array();
263
+        foreach ($loaded as $key => $data)
264 264
         {
265
-            $pieces = explode ( $this->sectionSeparator , $key );
266
-            $thisSection = trim ( $pieces[ 0 ] );
267
-            switch ( count ( $pieces ) )
265
+            $pieces = explode($this->sectionSeparator, $key);
266
+            $thisSection = trim($pieces[0]);
267
+            switch (count($pieces))
268 268
             {
269 269
                 case 1:
270
-                    $iniArray[ $thisSection ] = $data;
270
+                    $iniArray[$thisSection] = $data;
271 271
                     break;
272 272
 
273 273
                 case 2:
274
-                    $extendedSection = trim ( $pieces[ 1 ] );
275
-                    $iniArray[ $thisSection ] = array_merge ( array ( 'extends' => $extendedSection ) , $data );
274
+                    $extendedSection = trim($pieces[1]);
275
+                    $iniArray[$thisSection] = array_merge(array('extends' => $extendedSection), $data);
276 276
                     break;
277 277
 
278 278
                 default:
279
-                    throw new \Exception( "Section '$thisSection' may not extend multiple sections in $filename" );
279
+                    throw new \Exception("Section '$thisSection' may not extend multiple sections in $filename");
280 280
             }
281 281
         }
282 282
 
@@ -289,16 +289,16 @@  discard block
 block discarded – undo
289 289
      * @return \Classes\AdapterConfig\AbstractAdapter
290 290
      *
291 291
      */
292
-    private function factoryConfig ()
292
+    private function factoryConfig()
293 293
     {
294
-        switch ( strtolower ( $this->argv[ 'framework' ] ) )
294
+        switch (strtolower($this->argv['framework']))
295 295
         {
296 296
             case 'zf1':
297
-                return new ZendFrameworkOne( $this->argv );
297
+                return new ZendFrameworkOne($this->argv);
298 298
             case 'phalcon':
299
-                return new Phalcon( $this->argv );
299
+                return new Phalcon($this->argv);
300 300
             default:
301
-                return new None( $this->argv );
301
+                return new None($this->argv);
302 302
         }
303 303
 
304 304
     }
@@ -310,33 +310,33 @@  discard block
 block discarded – undo
310 310
      *
311 311
      * @return AdaptersDriver\AbsractAdapter
312 312
      */
313
-    private function factoryDriver ( AdapterConfig\AbstractAdapter $config )
313
+    private function factoryDriver(AdapterConfig\AbstractAdapter $config)
314 314
     {
315
-        switch ( $this->argv[ 'driver' ] )
315
+        switch ($this->argv['driver'])
316 316
         {
317 317
             case 'pgsql':
318 318
             case 'pdo_pgsql':
319
-                return new Pgsql( $config );
319
+                return new Pgsql($config);
320 320
             case 'mysql':
321 321
             case 'pdo_mysql':
322
-                return new Mysql( $config );
322
+                return new Mysql($config);
323 323
             case 'mssql':
324
-                return new Mssql( $config );
324
+                return new Mssql($config);
325 325
             case 'dblib':
326
-                return new Dblib( $config );
326
+                return new Dblib($config);
327 327
             case 'sqlsrv':
328
-                return new Sqlsrv( $config );
328
+                return new Sqlsrv($config);
329 329
         }
330 330
     }
331 331
 
332 332
     /**
333 333
      * @return AdapterConfig\AbstractAdapter
334 334
      */
335
-    public function getAdapterConfig ()
335
+    public function getAdapterConfig()
336 336
     {
337
-        if ( ! $this->adapterConfig instanceof AbstractAdapter )
337
+        if ( ! $this->adapterConfig instanceof AbstractAdapter)
338 338
         {
339
-            $this->adapterConfig = $this->factoryConfig ();
339
+            $this->adapterConfig = $this->factoryConfig();
340 340
         }
341 341
 
342 342
         return $this->adapterConfig;
@@ -345,11 +345,11 @@  discard block
 block discarded – undo
345 345
     /**
346 346
      * @return AdaptersDriver\AbsractAdapter
347 347
      */
348
-    public function getAdapterDriver ( AdapterConfig\AbstractAdapter $config )
348
+    public function getAdapterDriver(AdapterConfig\AbstractAdapter $config)
349 349
     {
350
-        if ( ! $this->adapterDriver )
350
+        if ( ! $this->adapterDriver)
351 351
         {
352
-            $this->adapterDriver = $this->factoryDriver ( $config );
352
+            $this->adapterDriver = $this->factoryDriver($config);
353 353
         }
354 354
 
355 355
         return $this->adapterDriver;
Please login to merge, or discard this patch.