Passed
Push — master ( 907ff6...ee34bd )
by Kris
26:30 queued 19:31
created
lib/ShellTablePrinter.php 2 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -58,12 +58,12 @@  discard block
 block discarded – undo
58 58
      */
59 59
     protected static $defaultVerticalSign = '|';
60 60
 
61
-     /**
62
-     * The default vertical sign. 
63
-     *
64
-     * @access protected
65
-     * @var    string
66
-     */
61
+        /**
62
+         * The default vertical sign. 
63
+         *
64
+         * @access protected
65
+         * @var    string
66
+         */
67 67
     protected static $defaultVerticalInnerSign = '+';
68 68
 
69 69
     /**
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
      */
99 99
     public static $verticalSeparator   = '|';
100 100
 
101
-   /**
101
+    /**
102 102
      * The vertical separator sign. 
103 103
      *
104 104
      * @access public
@@ -148,17 +148,17 @@  discard block
 block discarded – undo
148 148
         return self::getCliString(self::$verticalInnerSeparator === '' ? $str : substr($str, 0, strlen($str) -1). self::$verticalSeparator, $args);
149 149
     }
150 150
 
151
-     /**
152
-     * Gets a formated table row separator
153
-     *
154
-     * @access public
155
-     * @static method
156
-     * @param  string   [$color]        The text color for the wall row
157
-     * @param  string   [$bgcolor]      The back color for the wall row
158
-     * @param  string   [$option]+...   The text styles for the wall row
159
-     *
160
-     * @return string         
161
-     */
151
+        /**
152
+         * Gets a formated table row separator
153
+         *
154
+         * @access public
155
+         * @static method
156
+         * @param  string   [$color]        The text color for the wall row
157
+         * @param  string   [$bgcolor]      The back color for the wall row
158
+         * @param  string   [$option]+...   The text styles for the wall row
159
+         *
160
+         * @return string         
161
+         */
162 162
     public static function tableSeparator()
163 163
     {
164 164
         $args = func_get_args();
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
      *
248 248
      * @return string          
249 249
      */
250
-     public static function tableRow()
250
+        public static function tableRow()
251 251
     {
252 252
         // get and parse arguments:
253 253
         //  - extract first argument (columns list)
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      * @access public
81 81
      * @var    string
82 82
      */
83
-    public static $tableCellPadding    = ' ';
83
+    public static $tableCellPadding = ' ';
84 84
 
85 85
     /**
86 86
      * The horizontal separator sign. 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
      * @access public
97 97
      * @var    string
98 98
      */
99
-    public static $verticalSeparator   = '|';
99
+    public static $verticalSeparator = '|';
100 100
 
101 101
    /**
102 102
      * The vertical separator sign. 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
      * @access public
105 105
      * @var    string
106 106
      */
107
-    public static $verticalInnerSeparator   = '+';
107
+    public static $verticalInnerSeparator = '+';
108 108
            
109 109
     /**
110 110
      * Resets the default options
@@ -139,13 +139,13 @@  discard block
 block discarded – undo
139 139
         $columnsPads = !empty($args) ? $args[0] : [];
140 140
         array_shift($args);
141 141
 
142
-        $str = self::$verticalSeparator ;
143
-        $cellPaddingLenght = strlen(self::$tableCellPadding) *2;
144
-        foreach ($columnsPads as $key => $pad){
145
-            $str .= str_repeat(self::$horizontalSeparator , $pad + $cellPaddingLenght) .self::$verticalInnerSeparator ;
142
+        $str = self::$verticalSeparator;
143
+        $cellPaddingLenght = strlen(self::$tableCellPadding)*2;
144
+        foreach ($columnsPads as $key => $pad) {
145
+            $str .= str_repeat(self::$horizontalSeparator, $pad+$cellPaddingLenght).self::$verticalInnerSeparator;
146 146
         }
147 147
 
148
-        return self::getCliString(self::$verticalInnerSeparator === '' ? $str : substr($str, 0, strlen($str) -1). self::$verticalSeparator, $args);
148
+        return self::getCliString(self::$verticalInnerSeparator === '' ? $str : substr($str, 0, strlen($str)-1).self::$verticalSeparator, $args);
149 149
     }
150 150
 
151 151
      /**
@@ -165,12 +165,12 @@  discard block
 block discarded – undo
165 165
         $columnsPads = !empty($args) ? $args[0] : [];
166 166
         array_shift($args);
167 167
 
168
-        $str = self::$verticalSeparator ;
169
-        $cellPaddingLenght = strlen(self::$tableCellPadding) *2;
170
-        foreach ($columnsPads as $key => $pad){
171
-            $str .= str_repeat(self::$horizontalSeparator , $pad + $cellPaddingLenght) .self::$horizontalSeparator;
168
+        $str = self::$verticalSeparator;
169
+        $cellPaddingLenght = strlen(self::$tableCellPadding)*2;
170
+        foreach ($columnsPads as $key => $pad) {
171
+            $str .= str_repeat(self::$horizontalSeparator, $pad+$cellPaddingLenght).self::$horizontalSeparator;
172 172
         }
173
-        return self::getCliString(substr($str, 0, strlen($str) -1). self::$verticalSeparator, $args);
173
+        return self::getCliString(substr($str, 0, strlen($str)-1).self::$verticalSeparator, $args);
174 174
     }
175 175
 
176 176
     /**
@@ -193,12 +193,12 @@  discard block
 block discarded – undo
193 193
         $columnsPads = !empty($args) ? $args[0] : [];
194 194
         array_shift($args);
195 195
 
196
-        $str = self::$verticalSeparator ;
197
-        foreach ($columnsPads as $pad){
196
+        $str = self::$verticalSeparator;
197
+        foreach ($columnsPads as $pad) {
198 198
             $str .= self::$tableCellPadding. 
199 199
                     str_pad(' ', $pad).
200 200
                     self::$tableCellPadding. 
201
-                    self::$verticalSeparator ;
201
+                    self::$verticalSeparator;
202 202
         }
203 203
         return self::getCliString($str, $args);
204 204
     }
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
         $str = self::$verticalSeparator;
262 262
 
263 263
         // add columns        
264
-        foreach ($columns as $column => $pad){
264
+        foreach ($columns as $column => $pad) {
265 265
             $str .= self::$tableCellPadding. 
266 266
                     self::pad($column, $pad).
267 267
                     self::$tableCellPadding.
@@ -269,6 +269,6 @@  discard block
 block discarded – undo
269 269
         }
270 270
 
271 271
         // format full row
272
-        return self::getCliString($str, $args) ; 
272
+        return self::getCliString($str, $args); 
273 273
     }
274 274
 }
275 275
\ No newline at end of file
Please login to merge, or discard this patch.
lib/ShellPrinter.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      */
54 54
     public static function getColumns() 
55 55
     {
56
-        if (!self::isWin() ){
56
+        if (!self::isWin()) {
57 57
             return (int) shell_exec('tput cols');
58 58
         }
59 59
     }
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
      */
69 69
     public static function getLines() 
70 70
     {
71
-        if (!self::isWin() ){
71
+        if (!self::isWin()) {
72 72
             return (int) shell_exec('tput lines');
73 73
         }
74 74
     }
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
      */
84 84
     public static function newWindow() 
85 85
     {
86
-        if (!self::isWin() ){
86
+        if (!self::isWin()) {
87 87
             system('tput smcup');
88 88
             self::clear();
89 89
         }
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
      */
100 100
     public static function restoreWindow() 
101 101
     {
102
-        if (!self::isWin() ){
102
+        if (!self::isWin()) {
103 103
             system('tput rmcup');
104 104
         }
105 105
     }
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
      */
115 115
     public static function hideInput()
116 116
     {
117
-        if (!self::isWin() ){
117
+        if (!self::isWin()) {
118 118
             system('stty -echo');
119 119
         }
120 120
     }
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
      */
130 130
     public static function restoreInput()
131 131
     {
132
-        if (!self::isWin()){
132
+        if (!self::isWin()) {
133 133
             system('stty echo');
134 134
         }
135 135
     }
Please login to merge, or discard this patch.
lib/ShellColoredPrinter.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
         'magenta'      => '35', 
38 38
         'cyan'         => '36', 
39 39
         'lightgray'    => '37', 
40
-        'default'      => '39',   // your default color
40
+        'default'      => '39', // your default color
41 41
         'darkgray'     => '90',
42 42
         'lightred'     => '91',
43 43
         'lightgreen'   => '92',
@@ -83,12 +83,12 @@  discard block
 block discarded – undo
83 83
      * @var    array
84 84
      */
85 85
     protected static $options = array(
86
-        'none'         => '0',    // reset all styles
87
-        'bold'         => '1',    // 
86
+        'none'         => '0', // reset all styles
87
+        'bold'         => '1', // 
88 88
         'dim'          => '2',
89 89
         'underlined'   => '4',    
90 90
         'blink'        => '5', 
91
-        'reverse'      => '7',    // reverse foreground/background color
91
+        'reverse'      => '7', // reverse foreground/background color
92 92
 
93 93
         //formats=(["bold"]=1 ["bright"]=1 ["dim"]=2 ["underlined"]=4 ["blink"]=5 ["reverse"]=7 ["hidden"]=8)
94 94
         //resets=(["all"]=0 ["bold"]=21 ["bright"]=21 ["dim"]=22 ["underlined"]=24 ["blink"]=25 ["reverse"]=27 ["hidden"]=28)
@@ -130,27 +130,27 @@  discard block
 block discarded – undo
130 130
         array_shift($args);
131 131
 
132 132
         // 
133
-        switch($command){
133
+        switch ($command) {
134 134
 
135 135
             // ****************************************
136 136
             // Get methods (return string)
137 137
             // ****************************************
138 138
 
139 139
             case'text':
140
-                return self::getCliString($str, $args);             // get formated text
140
+                return self::getCliString($str, $args); // get formated text
141 141
             
142 142
             // ****************************************
143 143
             // Print methods (echo and return null)
144 144
             // ****************************************
145 145
             
146 146
             case'print':
147
-                echo (self::getCliString($str, $args));               // print text
147
+                echo (self::getCliString($str, $args)); // print text
148 148
                 break;
149 149
             case'log':
150
-                echo (self::getCliString($str, $args) . self::$EOF );   // print text + newline
150
+                echo (self::getCliString($str, $args).self::$EOF); // print text + newline
151 151
                 break;
152 152
             case'relog':
153
-                echo (self::getCliString($str ."\r", $args));         // overwrite current line 
153
+                echo (self::getCliString($str."\r", $args)); // overwrite current line 
154 154
                 break;
155 155
 
156 156
             // *****************************************
@@ -158,19 +158,19 @@  discard block
 block discarded – undo
158 158
             // *****************************************
159 159
 
160 160
             case'ask':
161
-                echo (self::getCliString($str, $args));     // print question
162
-                return trim(fgets(STDIN));                  // reads and return one line from STDIN 
161
+                echo (self::getCliString($str, $args)); // print question
162
+                return trim(fgets(STDIN)); // reads and return one line from STDIN 
163 163
            
164 164
             case'askPassword':
165
-                self::hideInput();                          // hide 
166
-                echo (self::getCliString($str, $args));     // print question
167
-                $line= trim(fgets(STDIN));                  // reads one line from STDIN 
168
-                self::restoreInput();                       // restore 
169
-                return $line;                               // return line
165
+                self::hideInput(); // hide 
166
+                echo (self::getCliString($str, $args)); // print question
167
+                $line = trim(fgets(STDIN)); // reads one line from STDIN 
168
+                self::restoreInput(); // restore 
169
+                return $line; // return line
170 170
                 
171 171
             case 'askInt':
172
-                echo (self::getCliString($str, $args));     // print question
173
-                fscanf(STDIN, "%d\n", $number);             // reads number from STDIN
172
+                echo (self::getCliString($str, $args)); // print question
173
+                fscanf(STDIN, "%d\n", $number); // reads number from STDIN
174 174
                 return (is_int($number) ? $number : false); // return int value or false
175 175
         }
176 176
 
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
      */
191 191
     protected static function getCliString(string $str, array $arguments = [])
192 192
     {
193
-        if (empty($arguments)){
193
+        if (empty($arguments)) {
194 194
             return $str;
195 195
         }
196 196
 
@@ -203,25 +203,25 @@  discard block
 block discarded – undo
203 203
         foreach ($arguments as $argument) {
204 204
             
205 205
             // it's a color?
206
-            if(!$hasColor && isset(self::$foregroundColors[$argument])){
206
+            if (!$hasColor && isset(self::$foregroundColors[$argument])) {
207 207
                 $cliArgs[] = self::$foregroundColors[$argument];
208 208
                 $hasColor = true;
209 209
 
210 210
             // it's a backcolor?
211
-            } elseif ($hasColor && !$hasBackColor && isset(self::$backgroundColors[$argument])){
211
+            } elseif ($hasColor && !$hasBackColor && isset(self::$backgroundColors[$argument])) {
212 212
                 $cliArgs[] = self::$backgroundColors[$argument];
213 213
                 $hasBackColor = true;
214 214
 
215 215
             // or it's an option?
216
-            } elseif (isset(self::$options[$argument])){
216
+            } elseif (isset(self::$options[$argument])) {
217 217
                 $cliArgs[] = self::$options[$argument];
218 218
             }
219 219
         }
220 220
 
221 221
         // Add string and end coloring
222 222
         // todo \e[0m 
223
-        $coloredString .= "\033[" . implode(';',$cliArgs) .'m';
224
-        $coloredString .=  $str . "\033[0m";
223
+        $coloredString .= "\033[".implode(';', $cliArgs).'m';
224
+        $coloredString .= $str."\033[0m";
225 225
         return $coloredString;
226 226
     }
227 227
 
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
      */
306 306
     public static function askPassword()
307 307
     {
308
-        return self::cmd('askPassword',func_get_args());
308
+        return self::cmd('askPassword', func_get_args());
309 309
     }
310 310
 
311 311
     /**
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
      */
323 323
     public static function log()
324 324
     {
325
-        self::cmd('log',func_get_args());
325
+        self::cmd('log', func_get_args());
326 326
     }
327 327
 
328 328
     /**
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
      */
340 340
     public static function relog()
341 341
     {
342
-        self::cmd('relog',func_get_args());
342
+        self::cmd('relog', func_get_args());
343 343
     }  
344 344
        
345 345
     /**
@@ -356,20 +356,20 @@  discard block
 block discarded – undo
356 356
      */    
357 357
     public function pad($input, $padLength, $padString = ' ', $padType = STR_PAD_RIGHT)
358 358
     {
359
-        $diff = $padLength - strlen(preg_replace('#\\033\[[[0-9;*]{1,}m#', '', $input));
359
+        $diff = $padLength-strlen(preg_replace('#\\033\[[[0-9;*]{1,}m#', '', $input));
360 360
         
361
-        if ($diff > 0){
362
-            switch ($padType){
361
+        if ($diff > 0) {
362
+            switch ($padType) {
363 363
                 
364 364
                 case STR_PAD_RIGHT:
365
-                    return $input . str_repeat($padString, $diff);
365
+                    return $input.str_repeat($padString, $diff);
366 366
                 
367 367
                 case STR_PAD_LEFT:
368
-                    return str_repeat($padString, $diff ) . $input;
368
+                    return str_repeat($padString, $diff).$input;
369 369
                 
370 370
                 case STR_PAD_BOTH:
371 371
                     $padLeft = round(($diff)/2);
372
-                    return str_repeat($padString, $padLeft) . $input . str_repeat($padString, $diff - $padLeft);
372
+                    return str_repeat($padString, $padLeft).$input.str_repeat($padString, $diff-$padLeft);
373 373
             }
374 374
         }
375 375
         return $input;
Please login to merge, or discard this patch.
lib/Program.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      */
48 48
     protected static function inArguments(array $arguments, string $shortArg, string $longArg)
49 49
     {
50
-          return array_key_exists($shortArg, $arguments) || array_key_exists($longArg, $arguments);
50
+            return array_key_exists($shortArg, $arguments) || array_key_exists($longArg, $arguments);
51 51
     }
52 52
 
53 53
     /**
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
      */
66 66
     protected static function getArgumentValue(array $arguments, string $shortArg, string $longArg)
67 67
     {
68
-          $val = array_key_exists($shortArg, $arguments) ? $arguments[$shortArg] : 
68
+            $val = array_key_exists($shortArg, $arguments) ? $arguments[$shortArg] : 
69 69
                  (array_key_exists($longArg, $arguments) ? $arguments[$longArg]  : null);
70 70
           
71 71
           
72
-          return $val;
72
+            return $val;
73 73
 
74 74
     }
75 75
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -65,8 +65,7 @@
 block discarded – undo
65 65
      */
66 66
     protected static function getArgumentValue(array $arguments, string $shortArg, string $longArg)
67 67
     {
68
-          $val = array_key_exists($shortArg, $arguments) ? $arguments[$shortArg] : 
69
-                 (array_key_exists($longArg, $arguments) ? $arguments[$longArg]  : null);
68
+          $val = array_key_exists($shortArg, $arguments) ? $arguments[$shortArg] : (array_key_exists($longArg, $arguments) ? $arguments[$longArg] : null);
70 69
           
71 70
           
72 71
           return $val;
Please login to merge, or discard this patch.
demo/demo.table.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -1,23 +1,23 @@  discard block
 block discarded – undo
1 1
 <?php
2
-require_once __DIR__ .'/../vendor/autoload.php';
2
+require_once __DIR__.'/../vendor/autoload.php';
3 3
 use Kristuff\Mishell\Console;
4 4
 
5 5
 console::resetDefaults();
6 6
 
7
-Console::log(' ' . Console::text('Basic sample', 'white', 'underlined'));
7
+Console::log(' '.Console::text('Basic sample', 'white', 'underlined'));
8 8
 Console::log();
9 9
 
10 10
 $rowHeaders = ['Index' => 10, 'Item'  => 25, 'Description' => 50];
11 11
 $rows = [
12
-    ['foo',       'some text for foo'],
13
-    ['bar',       'some text for bar'],
14
-    ['foobar',    'some text for foobar']
12
+    ['foo', 'some text for foo'],
13
+    ['bar', 'some text for bar'],
14
+    ['foobar', 'some text for foobar']
15 15
 ];
16 16
 Console::log(Console::tableSeparator($rowHeaders));
17 17
 Console::log(Console::tableRow($rowHeaders));
18 18
 Console::log(Console::tableRowSeparator($rowHeaders));
19 19
 
20
-foreach ($rows as $key => $value){
20
+foreach ($rows as $key => $value) {
21 21
     Console::log(Console::tableRow([
22 22
         $key            => 10, 
23 23
         $rows[$key][0]  => 25, 
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 // -------------------------------
35 35
 // ------ ADVANCED SAMPLE --------
36 36
 // -------------------------------
37
-Console::log(' ' . Console::text('Advanced sample', 'white', 'underlined'));
37
+Console::log(' '.Console::text('Advanced sample', 'white', 'underlined'));
38 38
 Console::log();
39 39
 
40 40
 $rowHeaders = [
@@ -44,16 +44,16 @@  discard block
 block discarded – undo
44 44
 ];
45 45
 $rows = [
46 46
     [
47
-        Console::text('foo (on right)',   'white'),     
47
+        Console::text('foo (on right)', 'white'),     
48 48
         Console::text('some centered text red for foo', 'red')
49 49
     ],
50 50
     [
51
-        Console::text('bar (on right)',   'white'),     
52
-        Console::text( 'some centered text green for bar', 'green')
51
+        Console::text('bar (on right)', 'white'),     
52
+        Console::text('some centered text green for bar', 'green')
53 53
     ],
54 54
     [
55 55
         Console::text('foobar (on right)', 'white'),    
56
-        'some centered text ' .Console::text('on BLUE here', 'white', 'blue'). ' for foobar' 
56
+        'some centered text '.Console::text('on BLUE here', 'white', 'blue').' for foobar' 
57 57
     ]
58 58
 ];
59 59
 
@@ -66,24 +66,24 @@  discard block
 block discarded – undo
66 66
 Console::$tableCellPadding = '  '; // increase cell padding to 2 white chars (default is 1)
67 67
 
68 68
 // table start
69
-Console::log(Console::tableSeparator($rowHeaders));    // top line             |-----------------------  ...
70
-Console::log(Console::tableRow($rowHeaders));          // columns headers      | foo     | bar     |---  ...
69
+Console::log(Console::tableSeparator($rowHeaders)); // top line             |-----------------------  ...
70
+Console::log(Console::tableRow($rowHeaders)); // columns headers      | foo     | bar     |---  ...
71 71
 Console::log(Console::tableRowSeparator($rowHeaders)); // saparator            |---------|---------|---  ...
72
-Console::log(Console::tableRowEmpty($rowHeaders));     // empty row            |         |         |     ...
72
+Console::log(Console::tableRowEmpty($rowHeaders)); // empty row            |         |         |     ...
73 73
 
74 74
 // tables rows
75
-foreach ($rows as $key => $value){
75
+foreach ($rows as $key => $value) {
76 76
 
77 77
     Console::log(
78
-        Console::TableRowStart().    // start row with separator. Then, each cell will end with a separator 
79
-        Console::TableRowCell($key, 10).                                   //no align => default is left
80
-        Console::TableRowCell($rows[$key][0] , 25, Console::ALIGN_RIGHT).  //set align right
81
-        Console::TableRowCell($rows[$key][1] , 50, Console::ALIGN_CENTER)  //set align center
78
+        Console::TableRowStart().// start row with separator. Then, each cell will end with a separator 
79
+        Console::TableRowCell($key, 10).//no align => default is left
80
+        Console::TableRowCell($rows[$key][0], 25, Console::ALIGN_RIGHT).//set align right
81
+        Console::TableRowCell($rows[$key][1], 50, Console::ALIGN_CENTER)  //set align center
82 82
     );
83 83
 }
84 84
 
85 85
 // table end
86
-Console::log(Console::tableRowEmpty($rowHeaders));     // empty row            |         |         |     ...
86
+Console::log(Console::tableRowEmpty($rowHeaders)); // empty row            |         |         |     ...
87 87
 Console::log(Console::tableSeparator($rowHeaders)); // saparator               |-----------------------  ...
88 88
 console::resetDefaults();
89 89
 
Please login to merge, or discard this patch.
demo/demo.size.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2
-require_once __DIR__ .'/../vendor/autoload.php';
2
+require_once __DIR__.'/../vendor/autoload.php';
3 3
 use Kristuff\Mishell\Console;
4 4
 
5
-Console::log(' '. Console::text('Overview:', 'underlined', 'bold'));
6
-Console::log("  - Use " .  Console::text("int ", 'blue'). Console::text("Console::getLines()", 'lightblue', 'underlined') . " get the number of lines in terminal.");
7
-Console::log("  - Use " .  Console::text("int ", 'blue'). Console::text("Console::getColumns()", 'lightblue', 'underlined') . " get the number of columns in terminal.");
5
+Console::log(' '.Console::text('Overview:', 'underlined', 'bold'));
6
+Console::log("  - Use ".Console::text("int ", 'blue').Console::text("Console::getLines()", 'lightblue', 'underlined')." get the number of lines in terminal.");
7
+Console::log("  - Use ".Console::text("int ", 'blue').Console::text("Console::getColumns()", 'lightblue', 'underlined')." get the number of columns in terminal.");
8 8
 Console::log();   
9 9
 Console::log();   
10
-Console::log(' '. Console::text('Sample:', 'underlined', 'bold'));
10
+Console::log(' '.Console::text('Sample:', 'underlined', 'bold'));
11 11
 Console::log();   
12 12
 
13 13
 // get columns and lines 
@@ -15,8 +15,8 @@  discard block
 block discarded – undo
15 15
 $cols  = Console::getColumns();
16 16
 
17 17
 // print value
18
-Console::log('  The number of lines is currently: ' .Console::text($lines, 'green'));
19
-Console::log('  The number of columns is currently: ' .Console::text($cols, 'green'));
18
+Console::log('  The number of lines is currently: '.Console::text($lines, 'green'));
19
+Console::log('  The number of columns is currently: '.Console::text($cols, 'green'));
20 20
 Console::log();   
21 21
 
22 22
 // build a 'full' row
Please login to merge, or discard this patch.
demo/demo.pad.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,30 +1,30 @@
 block discarded – undo
1 1
 <?php
2
-require_once __DIR__ .'/../vendor/autoload.php';
2
+require_once __DIR__.'/../vendor/autoload.php';
3 3
 use Kristuff\Mishell\Console;
4 4
 
5
-Console::log(' '. Console::text('Overview:', 'underlined', 'bold'));
6
-Console::log("  - Use " . Console::text("string ", 'blue'). Console::text("Console::pad()", 'lightblue', 'underlined') . "to get a text with given padding.");
7
-Console::log("  - The method is equivalent to php " . Console::text("str_pad()", 'lightblue', 'underlined'). " method, except that it handles not printable ANSI chars.");
5
+Console::log(' '.Console::text('Overview:', 'underlined', 'bold'));
6
+Console::log("  - Use ".Console::text("string ", 'blue').Console::text("Console::pad()", 'lightblue', 'underlined')."to get a text with given padding.");
7
+Console::log("  - The method is equivalent to php ".Console::text("str_pad()", 'lightblue', 'underlined')." method, except that it handles not printable ANSI chars.");
8 8
 Console::log();   
9
-Console::log(' '. Console::text('Sample:', 'underlined', 'bold'));
9
+Console::log(' '.Console::text('Sample:', 'underlined', 'bold'));
10 10
 
11 11
 // -----------------
12 12
 // sample start here
13 13
 // -----------------
14 14
 Console::log();     
15
-Console::log(' '. Console::text(' 1) Using ') . Console::text('php str_pad()', 'lightblue', 'underlined')); 
15
+Console::log(' '.Console::text(' 1) Using ').Console::text('php str_pad()', 'lightblue', 'underlined')); 
16 16
 Console::log();     
17 17
 Console::log(str_pad(' I am normal inside str_pad() {padLength:100, padString:\'*\'}', 100, '*'));
18 18
 Console::log(str_pad(Console::text(' I am colorized with ::text() inside str_pad() {padLength:100, padString:\'*\'}', 'lightcyan'), 100, '*'));
19 19
 Console::log();     
20
-Console::log(' '. Console::text(' => you should\'see what you expect. I guess second text has less than 100 chars... ', 'white', 'red')); 
20
+Console::log(' '.Console::text(' => you should\'see what you expect. I guess second text has less than 100 chars... ', 'white', 'red')); 
21 21
 Console::log();     
22 22
 Console::log();     
23
-Console::log(' '. Console::text(' 2) Using ') . Console::text('Console::pad()', 'lightblue', 'underlined')); 
23
+Console::log(' '.Console::text(' 2) Using ').Console::text('Console::pad()', 'lightblue', 'underlined')); 
24 24
 Console::log();     
25 25
 Console::log(Console::pad('  I am normal inside ::pad() {padLength:100, padString:\'*\'}', 100, '*'));
26 26
 Console::log(Console::pad(Console::text('  I am colorized with ::text() inside ::pad() {padLength:100, padString:\'*\'}', 'lightcyan'), 100, '*'));
27 27
 Console::log();     
28
-Console::log(' '. Console::text(' => should be OK ', 'white', 'green'));
28
+Console::log(' '.Console::text(' => should be OK ', 'white', 'green'));
29 29
 
30 30
 ?>
Please login to merge, or discard this patch.
demo/demo.progress.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
 Console::log("   - you may need to use " . Console::text("php str_pad()", 'lightblue', 'underlined') . " method to be sure all previous text is overwitted.");
11 11
 Console::log("   - You can customize colors (foreground and background) and some styles in same way than ");
12 12
 Console::log('     with ' . Console::text("Console::text()", 'lightblue', 'underlined') . 
13
-                 ' and ' .  Console::text("Console::log()", 'lightblue', 'underlined'). ' methods.');
13
+                    ' and ' .  Console::text("Console::log()", 'lightblue', 'underlined'). ' methods.');
14 14
 Console::log();
15 15
 Console::log(' '. Console::text('Sample code:', 'underlined', 'bold'));
16 16
 Console::log();
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,23 +1,23 @@  discard block
 block discarded – undo
1 1
 <?php
2
-require_once __DIR__ .'/../vendor/autoload.php';
2
+require_once __DIR__.'/../vendor/autoload.php';
3 3
 use Kristuff\Mishell\Console;
4 4
 
5
-Console::log(' '. Console::text('Overview:', 'underlined', 'bold'));
6
-Console::log("  - Use " . Console::text("Console::relog()", 'lightblue', 'underlined') . " to overwrite the current line.", 'white');
5
+Console::log(' '.Console::text('Overview:', 'underlined', 'bold'));
6
+Console::log("  - Use ".Console::text("Console::relog()", 'lightblue', 'underlined')." to overwrite the current line.", 'white');
7 7
 Console::log();
8 8
 
9
-Console::log(' '. Console::text('Tips:', 'underlined', 'bold'));
10
-Console::log("   - you may need to use " . Console::text("php str_pad()", 'lightblue', 'underlined') . " method to be sure all previous text is overwitted.");
9
+Console::log(' '.Console::text('Tips:', 'underlined', 'bold'));
10
+Console::log("   - you may need to use ".Console::text("php str_pad()", 'lightblue', 'underlined')." method to be sure all previous text is overwitted.");
11 11
 Console::log("   - You can customize colors (foreground and background) and some styles in same way than ");
12
-Console::log('     with ' . Console::text("Console::text()", 'lightblue', 'underlined') . 
13
-                 ' and ' .  Console::text("Console::log()", 'lightblue', 'underlined'). ' methods.');
12
+Console::log('     with '.Console::text("Console::text()", 'lightblue', 'underlined'). 
13
+                 ' and '.Console::text("Console::log()", 'lightblue', 'underlined').' methods.');
14 14
 Console::log();
15
-Console::log(' '. Console::text('Sample code:', 'underlined', 'bold'));
15
+Console::log(' '.Console::text('Sample code:', 'underlined', 'bold'));
16 16
 Console::log();
17
-Console::log('    '.Console::text(str_pad('// fake progress loop ', 100),'green'));
17
+Console::log('    '.Console::text(str_pad('// fake progress loop ', 100), 'green'));
18 18
 Console::log('    '.Console::text(str_pad('for ($i=0 ; $i<=10 ; $i++) {', 100), 'lightgray'));
19
-Console::log('    '.Console::text(str_pad('    // Overwrite progress message.',  100), 'green'));
20
-Console::log('    '.Console::text(str_pad("    Console::relog(' I am a progress text... ['.Console::text($\i, 'green') .']% completed');",  100),'lightgray'));
19
+Console::log('    '.Console::text(str_pad('    // Overwrite progress message.', 100), 'green'));
20
+Console::log('    '.Console::text(str_pad("    Console::relog(' I am a progress text... ['.Console::text($\i, 'green') .']% completed');", 100), 'lightgray'));
21 21
 Console::log('    '.Console::text(str_pad("    // wait for a while, so we see the animation ", 100), 'green'));
22 22
 Console::log('    '.Console::text(str_pad('    usleep(300000);', 100), 'lightgray'));
23 23
 Console::log('    '.Console::text(str_pad('}', 100), 'lightgray'));
@@ -34,16 +34,16 @@  discard block
 block discarded – undo
34 34
 Console::log('    '.Console::text(str_pad("// note: you may need to use str_pad() method to be sure all previous text is overwritten", 100), 'green'));
35 35
 Console::log('    '.Console::text(str_pad("Console::relog(Console::text('Done!', 'white', 'green', 'underlined'). str_pad(' ', 100);", 100), 'lightgray'));
36 36
 Console::log();
37
-Console::log(' ' .'    '.Console::text('Sample result:', 'underlined', 'bold'));
37
+Console::log(' '.'    '.Console::text('Sample result:', 'underlined', 'bold'));
38 38
 // -----------------
39 39
 // sample start here
40 40
 // -----------------
41 41
 
42 42
 // fake progress message 
43
-for ($i=0 ; $i<=100 ; $i++) {
43
+for ($i = 0; $i <= 100; $i++) {
44 44
 
45 45
     // Overwrite progress message. 
46
-    Console::relog(' I am a progress text... ['.Console::text($i, 'green') .']% completed');
46
+    Console::relog(' I am a progress text... ['.Console::text($i, 'green').']% completed');
47 47
 
48 48
     // wait for a while, so we see the animation
49 49
     usleep(100000); 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 
60 60
 // Overwrite progress message. 
61 61
 // note: you may need to use str_pad() method to be sure all previous text is overwritten.
62
-Console::relog(Console::text(' Done!', 'white', 'green', 'underlined'). str_pad(' ', 100));
62
+Console::relog(Console::text(' Done!', 'white', 'green', 'underlined').str_pad(' ', 100));
63 63
 Console::log('');
64 64
 
65 65
 ?>
Please login to merge, or discard this patch.
demo/demo.window.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2
-require_once __DIR__ .'/../vendor/autoload.php';
2
+require_once __DIR__.'/../vendor/autoload.php';
3 3
 use Kristuff\Mishell\Console;
4 4
 
5 5
 Console::log(' Let say we are current window.');
6
-Console::log(' We will open a new window using ' . Console::text('Console::newWindow()', 'lightblue', 'underlined') . ' method.');
6
+Console::log(' We will open a new window using '.Console::text('Console::newWindow()', 'lightblue', 'underlined').' method.');
7 7
 Console::ask(' Press [Enter] to open new window > ');
8 8
 
9 9
 // ------------------
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 Console::log('          NEW WINDOW 1        ', 'green');
18 18
 Console::log(' _____________________________', 'green');
19 19
 Console::log();
20
-Console::log(' I am in new window. We will restore the window later using ' .  Console::text('Console::restoreWindow()', 'lightblue', 'underlined') . ' method.' );
20
+Console::log(' I am in new window. We will restore the window later using '.Console::text('Console::restoreWindow()', 'lightblue', 'underlined').' method.');
21 21
 Console::ask(' Press [Enter] to restore >');
22 22
 
23 23
 // ------------------
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
25 25
 // ------------------
26 26
 Console::restoreWindow();
27 27
 
28
-Console::log(' We have now restored the current window using ' . Console::text('Console::restoreWindow()', 'lightblue', 'underlined') . ' method');
29
-Console::log(' We will reopen a new window using ' . Console::text('Console::newWindow()', 'lightblue', 'underlined') . ' method.');
28
+Console::log(' We have now restored the current window using '.Console::text('Console::restoreWindow()', 'lightblue', 'underlined').' method');
29
+Console::log(' We will reopen a new window using '.Console::text('Console::newWindow()', 'lightblue', 'underlined').' method.');
30 30
 Console::ask(' Press [Enter] to open new window > ');
31 31
 
32 32
 // ------------------
@@ -40,14 +40,14 @@  discard block
 block discarded – undo
40 40
 Console::log('          NEW WINDOW 2        ', 'yellow');
41 41
 Console::log(' _____________________________', 'yellow');
42 42
 Console::log();
43
-Console::log(' I am in new window. We will restore the window later using ' .  Console::text('Console::restoreWindow()', 'lightblue', 'underlined') . ' method.' );
43
+Console::log(' I am in new window. We will restore the window later using '.Console::text('Console::restoreWindow()', 'lightblue', 'underlined').' method.');
44 44
 Console::ask(' Press [Enter] to restore >');
45 45
 
46 46
 // ------------------
47 47
 // restore new window
48 48
 // ------------------
49 49
 Console::restoreWindow();
50
-Console::log(' We have now restored the current window using ' .  Console::text('Console::restoreWindow()', 'lightblue', 'underlined') . ' method. That\'s all.');
51
-Console::log(' Got it'. Console::text('?', 'green'));
50
+Console::log(' We have now restored the current window using '.Console::text('Console::restoreWindow()', 'lightblue', 'underlined').' method. That\'s all.');
51
+Console::log(' Got it'.Console::text('?', 'green'));
52 52
 
53 53
 ?>
Please login to merge, or discard this patch.