Passed
Pull Request — master (#11)
by Kris
01:20
created
demo/demo.bluescreen.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  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
 // *open* new window
@@ -10,16 +10,16 @@  discard block
 block discarded – undo
10 10
 $cols = Console::getColumns();
11 11
 $middle = round($lines/2);
12 12
 
13
-for ($i= 0; $i <= $lines ; $i++){
13
+for ($i = 0; $i <= $lines; $i++) {
14 14
 
15
-    switch($i){
16
-        case $middle -1:
15
+    switch ($i) {
16
+        case $middle-1:
17 17
             Console::log(Console::pad(":( Houston, we've had a problem...", $cols, ' ', STR_PAD_BOTH), 'white', 'blue');
18 18
             break;
19 19
         case $middle :
20 20
             Console::log(Console::pad('an error occurred in my head,', $cols, ' ', STR_PAD_BOTH), 'white', 'blue');
21 21
             break;
22
-        case $middle +1:
22
+        case $middle+1:
23 23
             Console::log(Console::pad('I really want you to see the blue screen of the death', $cols, ' ', STR_PAD_BOTH), 'white', 'blue');
24 24
             break;
25 25
         default:
Please login to merge, or discard this patch.
demo/demo.bgcolors.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  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
 $rowHeaders = ['#Num' => 7, 'Color name' => 15, ' ANSI Code'  => 15, ' Sample ouput' => 50];
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
 Console::log('  '.Console::tableRowEmpty($rowHeaders));
11 11
 
12 12
 $i = 1;
13
-foreach (Console::getStyles()['backgrounds'] as $bgcolor => $colorValue ){
14
-    $foregroundColor = $bgcolor === 'black' ? 'white': 'black';
13
+foreach (Console::getStyles()['backgrounds'] as $bgcolor => $colorValue) {
14
+    $foregroundColor = $bgcolor === 'black' ? 'white' : 'black';
15 15
     Console::log('  '.Console::tableRow([
16
-       ' ' . $i     => 7,
16
+       ' '.$i     => 7,
17 17
         $bgcolor        => 15, 
18
-       "\\033[" . $colorValue  .'m'  => 15, 
19
-        Console::text(str_pad('I am a text color={' . $foregroundColor .'} on bgcolor={' . $bgcolor .'}', 48), $foregroundColor , $bgcolor) => 50
18
+       "\\033[".$colorValue.'m'  => 15, 
19
+        Console::text(str_pad('I am a text color={'.$foregroundColor.'} on bgcolor={'.$bgcolor.'}', 48), $foregroundColor, $bgcolor) => 50
20 20
     ]));
21 21
     $i++;
22 22
 }
Please login to merge, or discard this patch.
demo/demo.table.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-require_once __DIR__ .'/../vendor/autoload.php';
3
+require_once __DIR__.'/../vendor/autoload.php';
4 4
 use Kristuff\Mishell\Console;
5 5
 
6 6
 Console::log('Basic sample', 'white', 'magenta');
@@ -8,15 +8,15 @@  discard block
 block discarded – undo
8 8
 
9 9
 $rowHeaders = ['Index' => 10, 'Item'  => 25, 'Description' => 50];
10 10
 $rows = [
11
-    ['foo',        'some text for foo'],
12
-    ['bar',       'some text for bar'],
13
-    ['foobar',    'some text for foobar']
11
+    ['foo', 'some text for foo'],
12
+    ['bar', 'some text for bar'],
13
+    ['foobar', 'some text for foobar']
14 14
 ];
15 15
 Console::log(Console::tableSeparator($rowHeaders));
16 16
 Console::log(Console::tableRow($rowHeaders));
17 17
 Console::log(Console::tableRowSeparator($rowHeaders));
18 18
 
19
-foreach ($rows as $key => $value){
19
+foreach ($rows as $key => $value) {
20 20
     Console::log(Console::tableRow([
21 21
         $key            => 10, 
22 22
         $rows[$key][0]  => 25, 
@@ -43,16 +43,16 @@  discard block
 block discarded – undo
43 43
 ];
44 44
 $rows = [
45 45
     [
46
-        Console::text('foo (on right)',   'white'),     
46
+        Console::text('foo (on right)', 'white'),     
47 47
         Console::text('some centered text red for foo', 'red')
48 48
     ],
49 49
     [
50
-        Console::text('bar (on right)',   'white'),     
51
-        Console::text( 'some centered text gray for bar', 'gray')
50
+        Console::text('bar (on right)', 'white'),     
51
+        Console::text('some centered text gray for bar', 'gray')
52 52
     ],
53 53
     [
54 54
         Console::text('foobar (on right)', 'white'),    
55
-        'some centered text ' .Console::text('on BLUE here', 'white', 'blue'). ' for foobar' 
55
+        'some centered text '.Console::text('on BLUE here', 'white', 'blue').' for foobar' 
56 56
     ]
57 57
 ];
58 58
 
@@ -65,23 +65,23 @@  discard block
 block discarded – undo
65 65
 Console::$tableCellPadding = '  '; // increase cell padding to 2 white chars (default is 1)
66 66
 
67 67
 // table start
68
-Console::log(Console::tableSeparator($rowHeaders));    // top line             |-----------------------  ...
69
-Console::log(Console::tableRow($rowHeaders));          // columns headers      | foo     | bar     |---  ...
68
+Console::log(Console::tableSeparator($rowHeaders)); // top line             |-----------------------  ...
69
+Console::log(Console::tableRow($rowHeaders)); // columns headers      | foo     | bar     |---  ...
70 70
 Console::log(Console::tableRowSeparator($rowHeaders)); // saparator            |---------|---------|---  ...
71
-Console::log(Console::tableRowEmpty($rowHeaders));     // empty row            |         |         |     ...
71
+Console::log(Console::tableRowEmpty($rowHeaders)); // empty row            |         |         |     ...
72 72
 
73 73
 // tables rows
74
-foreach ($rows as $key => $value){
74
+foreach ($rows as $key => $value) {
75 75
 
76 76
     Console::log(
77
-        Console::TableRowStart().    // start row with separator. Then, each cell will end with a separator 
78
-        Console::TableRowCell($key, 10).                                   //no align => default is left
79
-        Console::TableRowCell($rows[$key][0] , 25, Console::ALIGN_RIGHT).  //set align right
80
-        Console::TableRowCell($rows[$key][1] , 50, Console::ALIGN_CENTER)  //set align center
77
+        Console::TableRowStart().// start row with separator. Then, each cell will end with a separator 
78
+        Console::TableRowCell($key, 10).//no align => default is left
79
+        Console::TableRowCell($rows[$key][0], 25, Console::ALIGN_RIGHT).//set align right
80
+        Console::TableRowCell($rows[$key][1], 50, Console::ALIGN_CENTER)  //set align center
81 81
     );
82 82
 }
83 83
 
84 84
 // table end
85
-Console::log(Console::tableRowEmpty($rowHeaders));     // empty row            |         |         |     ...
85
+Console::log(Console::tableRowEmpty($rowHeaders)); // empty row            |         |         |     ...
86 86
 Console::log(Console::tableSeparator($rowHeaders)); // saparator               |-----------------------  ...
87 87
 
Please login to merge, or discard this patch.
demo/demo.pad.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  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('Overview:', 'underline', 'bold');
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 Console::log('');   
9 9
 Console::log('Sample:', 'underline', 'bold');
10 10
 Console::log('');   
11
-Console::log('1) ' . Console::text('Using php str_pad()', 'white', 'magenta', 'bold', 'underline')); 
11
+Console::log('1) '.Console::text('Using php str_pad()', 'white', 'magenta', 'bold', 'underline')); 
12 12
 Console::log('');   
13 13
 Console::log(str_pad('I am normal inside str_pad() {padLength:100, padString:\'*\'}', 100, '*'));
14 14
 Console::log(str_pad(Console::text('I am colorized with ::text() inside str_pad() {padLength:100, padString:\'*\'}', 'blue'), 100, '*'));
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 Console::log('=> you should\'see what you expect. I guess second text has less than 100 chars...', 'white', 'red'); 
17 17
 Console::log('');   
18 18
 Console::log('');   
19
-Console::log('2) ' . Console::text('Using Console::pad()', 'white', 'magenta', 'bold', 'underline')); 
19
+Console::log('2) '.Console::text('Using Console::pad()', 'white', 'magenta', 'bold', 'underline')); 
20 20
 Console::log('');   
21 21
 Console::log(Console::pad('I am normal inside ::pad() {padLength:100, padString:\'*\'}', 100, '*'));
22 22
 Console::log(Console::pad(Console::text('I am colorized with ::text() inside ::pad() {padLength:100, padString:\'*\'}', 'blue'), 100, '*'));
Please login to merge, or discard this patch.
demo/demo.size.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  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('Overview:', 'underline', 'bold');
6
-Console::log("  - Use " .  Console::text("int Console::getLines()", 'blue', 'white') . " get the number of lines in terminal.");
7
-Console::log("  - Use " .  Console::text("int Console::getColumns()", 'blue', 'white') . " get the number of columns in terminal.");
6
+Console::log("  - Use ".Console::text("int Console::getLines()", 'blue', 'white')." get the number of lines in terminal.");
7
+Console::log("  - Use ".Console::text("int Console::getColumns()", 'blue', 'white')." get the number of columns in terminal.");
8 8
 Console::log('');
9 9
 Console::log('');
10 10
 Console::log('Sample:', 'underline', 'bold');
@@ -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.allstyles.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  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
 $rowHeaders1 = ['Background' => 15, 'Colors' => 15, 'Style(s)' => 45, 'Output' => 50];
6 6
 
7 7
 $headers = ['Background' => 15];
8
-foreach (Console::getStyles()['backgrounds'] as $color => $colorValue ){
8
+foreach (Console::getStyles()['backgrounds'] as $color => $colorValue) {
9 9
         $headers[] = [$color => 20];
10 10
 }
11 11
 
@@ -29,18 +29,18 @@  discard block
 block discarded – undo
29 29
 Console::log('  '.Console::tableRow($headerStyles));
30 30
 Console::log('  '.Console::tableRowSeparator($headerStyles));
31 31
 
32
-foreach (Console::getStyles()['backgrounds'] as $color => $colorValue ){
32
+foreach (Console::getStyles()['backgrounds'] as $color => $colorValue) {
33 33
         
34 34
 }
35 35
 
36 36
 
37 37
 
38
-foreach (Console::getStyles()['backgrounds'] as $color => $colorValue ){
38
+foreach (Console::getStyles()['backgrounds'] as $color => $colorValue) {
39 39
     Console::log('  '.Console::tableRow([
40
-       ' ' . $i     => 7,
40
+       ' '.$i     => 7,
41 41
         $color        => 15, 
42
-       "\\033[" . $colorValue  .'m'  => 15, 
43
-        Console::text(str_pad('I am a text color={normal} bgcolor={' . $color .'}', 48),  'normal', $color) => 50
42
+       "\\033[".$colorValue.'m'  => 15, 
43
+        Console::text(str_pad('I am a text color={normal} bgcolor={'.$color.'}', 48), 'normal', $color) => 50
44 44
     ]));
45 45
     Console::log('  '.Console::tableEmptyRow();
46 46
      $i++;
Please login to merge, or discard this patch.
demo/demo.bell.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-require_once __DIR__ .'/../vendor/autoload.php';
3
+require_once __DIR__.'/../vendor/autoload.php';
4 4
 use Kristuff\Mishell\Console;
5 5
 
6 6
 Console::log('Overview:', 'underline', 'bold');
@@ -9,8 +9,8 @@  discard block
 block discarded – undo
9 9
 
10 10
 Console::log('Usage:', 'underline', 'bold');
11 11
 Console::log('');
12
-Console::log('   ' .Console::text(str_pad('// Play the bell', 60), 'red',   'white'));
13
-Console::log('   ' .Console::text(str_pad('Console::bell();', 60), 'black', 'white'));
12
+Console::log('   '.Console::text(str_pad('// Play the bell', 60), 'red', 'white'));
13
+Console::log('   '.Console::text(str_pad('Console::bell();', 60), 'black', 'white'));
14 14
 Console::log('');
15 15
 
16 16
 Console::log('Sample:', 'underline', 'bold');
Please login to merge, or discard this patch.
demo/index.php 1 patch
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  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::clear();
@@ -18,26 +18,26 @@  discard block
 block discarded – undo
18 18
 
19 19
     Console::log();
20 20
     Console::log();
21
-    Console::log('    '. Console::text("                _  ", 'black', 'white') . Console::text("  ____  _          _ _    ", 'magenta', 'white'));
22
-    Console::log('    '. Console::text("      _ __ ___ (_) ", 'black', 'white') . Console::text(" / ___|| |__   ___| | |   ", 'magenta', 'white'));
23
-    Console::log('    '. Console::text("     | '_ ` _ \| | ", 'black', 'white') . Console::text(" \___ \| '_ \ / _ \ | |   ", 'magenta', 'white'));
24
-    Console::log('    '. Console::text("     | | | | | | | ", 'black', 'white') . Console::text("  ___) | | | |  __/ | |   ", 'magenta', 'white'));
25
-    Console::log('    '. Console::text("     |_| |_| |_|_| ", 'black', 'white') . Console::text(" |____/|_| |_|\___|_|_|   ", 'magenta', 'white'));
26
-    Console::log('    '. Console::text("                   ", 'black', 'white') . Console::text("                          ", 'magenta', 'white'));
27
-    Console::log('    '. Console::text("                   ", 'black', 'white') . Console::text("        Version 1.0       ", 'black', 'white'));
28
-    Console::log('    '. Console::text("                   ", 'black', 'white') . Console::text("        © 2020 Kristuff   ", 'black', 'white'));
29
-    Console::log('    '. Console::text("                   ", 'black', 'white') . Console::text("                          ", 'magenta', 'white'));
21
+    Console::log('    '.Console::text("                _  ", 'black', 'white').Console::text("  ____  _          _ _    ", 'magenta', 'white'));
22
+    Console::log('    '.Console::text("      _ __ ___ (_) ", 'black', 'white').Console::text(" / ___|| |__   ___| | |   ", 'magenta', 'white'));
23
+    Console::log('    '.Console::text("     | '_ ` _ \| | ", 'black', 'white').Console::text(" \___ \| '_ \ / _ \ | |   ", 'magenta', 'white'));
24
+    Console::log('    '.Console::text("     | | | | | | | ", 'black', 'white').Console::text("  ___) | | | |  __/ | |   ", 'magenta', 'white'));
25
+    Console::log('    '.Console::text("     |_| |_| |_|_| ", 'black', 'white').Console::text(" |____/|_| |_|\___|_|_|   ", 'magenta', 'white'));
26
+    Console::log('    '.Console::text("                   ", 'black', 'white').Console::text("                          ", 'magenta', 'white'));
27
+    Console::log('    '.Console::text("                   ", 'black', 'white').Console::text("        Version 1.0       ", 'black', 'white'));
28
+    Console::log('    '.Console::text("                   ", 'black', 'white').Console::text("        © 2020 Kristuff   ", 'black', 'white'));
29
+    Console::log('    '.Console::text("                   ", 'black', 'white').Console::text("                          ", 'magenta', 'white'));
30 30
     Console::log();
31 31
     Console::log();
32 32
  
33 33
     $pad = '    ';
34 34
 
35 35
     // fake progress message 
36
-    for ($i=0 ; $i<=100 ; $i++) {
36
+    for ($i = 0; $i <= 100; $i++) {
37 37
 
38 38
         // Overwrite progress message. 
39 39
         Console::relog($pad.Console::text('Loading... [', 'white').
40
-                            Console::text($i .'%', 'green').
40
+                            Console::text($i.'%', 'green').
41 41
                             Console::text('] completed', 'white'));
42 42
 
43 43
         // wait for a while, so we see the animation
@@ -55,25 +55,25 @@  discard block
 block discarded – undo
55 55
 
56 56
 
57 57
     
58
-    $index[1] =   ['Styles',        'How to get available basic styles',                'demo.styles.php'];
59
-    $index[2] =   ['Colors',        'How to get available foreground colors',           'demo.colors.php'];
60
-    $index[3] =   ['Backgrounds',   'How to get available background colors',           'demo.bgcolors.php'];
58
+    $index[1] = ['Styles', 'How to get available basic styles', 'demo.styles.php'];
59
+    $index[2] = ['Colors', 'How to get available foreground colors', 'demo.colors.php'];
60
+    $index[3] = ['Backgrounds', 'How to get available background colors', 'demo.bgcolors.php'];
61 61
    
62
-    $index[11] =  ['Ask',           'How to ask? (get user input)',                     'demo.ask.php'];
63
-    $index[12] =  ['Ask Number',    'How to ask and expect a number?',                  'demo.askint.php'];
64
-    $index[13] =  ['Ask Password',  'How to ask a password? (do not print user input)', 'demo.askpassword.php'];
62
+    $index[11] = ['Ask', 'How to ask? (get user input)', 'demo.ask.php'];
63
+    $index[12] = ['Ask Number', 'How to ask and expect a number?', 'demo.askint.php'];
64
+    $index[13] = ['Ask Password', 'How to ask a password? (do not print user input)', 'demo.askpassword.php'];
65 65
    
66
-    $index[14] =  ['Table',         'How to print a table?',                            'demo.table.php'];
67
-    $index[15] =  ['Bell',          'How to run the bell?',                             'demo.bell.php'];
68
-    $index[16] =  ['Progress',      'How to output progress message?',                  'demo.progress.php'];
69
-    $index[17] =  ['New window',    'How to open new/restore window?',                  'demo.window.php'];
66
+    $index[14] = ['Table', 'How to print a table?', 'demo.table.php'];
67
+    $index[15] = ['Bell', 'How to run the bell?', 'demo.bell.php'];
68
+    $index[16] = ['Progress', 'How to output progress message?', 'demo.progress.php'];
69
+    $index[17] = ['New window', 'How to open new/restore window?', 'demo.window.php'];
70 70
 
71 71
 //  $index[4] = ['Text',  'Console::text() overview',    'demo.log.php'];      
72 72
 //  $index[5] = ['Log',   'Console::log() overview',     'demo.log.php'];      
73 73
 //  $index[6] = ['ReLog', 'Console::relog() overview',   'demo.relog.php'];    
74
-    $index[7] = ['Pad',             'Console::pad() overview',                          'demo.pad.php'];
75
-    $index[8] = ['Size',  'How to get the number of columns and lines in terminal',     'demo.size.php'];
76
-    $index[9] = ['BlueScreen',  'Really nice full screen centered message sample',      'demo.bluescreen.php'];
74
+    $index[7] = ['Pad', 'Console::pad() overview', 'demo.pad.php'];
75
+    $index[8] = ['Size', 'How to get the number of columns and lines in terminal', 'demo.size.php'];
76
+    $index[9] = ['BlueScreen', 'Really nice full screen centered message sample', 'demo.bluescreen.php'];
77 77
   
78 78
     return $index;
79 79
 }
@@ -91,16 +91,16 @@  discard block
 block discarded – undo
91 91
 
92 92
 function writeSampleHeader($index, $title)
93 93
 {
94
-    Console::log('      ' . Console::text(Console::pad('',      20, ' ', STR_PAD_BOTH), 'white', 'bold', 'underline'));
95
-    Console::log('      ' . Console::text(Console::pad('',      20, ' ', STR_PAD_BOTH), 'white', 'yellow', 'bold'));
96
-    Console::log('      ' . Console::text(Console::pad($index .' - ' . $title,  20, ' ', STR_PAD_BOTH), 'white', 'yellow', 'bold'));
97
-    Console::log('      ' . Console::text(Console::pad('',      20, ' ', STR_PAD_BOTH), 'white', 'yellow', 'bold', 'underline'));
94
+    Console::log('      '.Console::text(Console::pad('', 20, ' ', STR_PAD_BOTH), 'white', 'bold', 'underline'));
95
+    Console::log('      '.Console::text(Console::pad('', 20, ' ', STR_PAD_BOTH), 'white', 'yellow', 'bold'));
96
+    Console::log('      '.Console::text(Console::pad($index.' - '.$title, 20, ' ', STR_PAD_BOTH), 'white', 'yellow', 'bold'));
97
+    Console::log('      '.Console::text(Console::pad('', 20, ' ', STR_PAD_BOTH), 'white', 'yellow', 'bold', 'underline'));
98 98
     Console::log();
99 99
 }
100 100
 
101 101
 function writeIndex()
102 102
 {
103
-    Console::log(' '. Console::text('Index:', 'underline', 'bold'));
103
+    Console::log(' '.Console::text('Index:', 'underline', 'bold'));
104 104
     $rowHeaders = ['Index' => 10, 'Item'  => 25, 'Description' => 70];
105 105
 
106 106
     // customize table separator
@@ -125,18 +125,18 @@  discard block
 block discarded – undo
125 125
     Console::log(' '.Console::tableRowEmpty($rowHeaders, 'white', 'cyan'));
126 126
 
127 127
     $i = 0;
128
-    foreach (getIndex() as $key => $value){
128
+    foreach (getIndex() as $key => $value) {
129 129
        
130
-       if (file_exists( __DIR__ . '/'. $value[2])) {
130
+       if (file_exists(__DIR__.'/'.$value[2])) {
131 131
             Console::log(' '.
132 132
                 Console::tableRow([
133 133
                     $key        => 10, 
134 134
                     $value[0]   => 25, 
135 135
                     $value[1]   => 70
136 136
                 ], 
137
-                    ($i % 2 == 1) ? 'white' :  'white',  
138
-                    ($i % 2 == 1) ? 'cyan' :   'cyan',
139
-                    ($i % 2 == 1) ? ''      :  'bold'
137
+                    ($i%2 == 1) ? 'white' : 'white',  
138
+                    ($i%2 == 1) ? 'cyan' : 'cyan',
139
+                    ($i%2 == 1) ? '' : 'bold'
140 140
                 )
141 141
             );
142 142
             $i++;
@@ -151,19 +151,19 @@  discard block
 block discarded – undo
151 151
     // --------------------
152 152
 
153 153
     Console::log('');
154
-    Console::log(' ' .Console::text('Tips:', 'underline', 'bold'));
155
-    Console::log(' '. Console::text('- At any time you can stop this program using [', 'green') .Console::text('Ctrl+C', 'black','white') .Console::text(']', 'green'));
154
+    Console::log(' '.Console::text('Tips:', 'underline', 'bold'));
155
+    Console::log(' '.Console::text('- At any time you can stop this program using [', 'green').Console::text('Ctrl+C', 'black', 'white').Console::text(']', 'green'));
156 156
     Console::log('');
157 157
 }
158 158
 
159 159
 function askIndex()
160 160
 {
161
-    $base = Console::text('~miShell^^' , 'yellow');
162
-    $base .= Console::text(' $ ' , 'gray');
163
-    $selectedIndex = Console::askInt($base . Console::text('Enter desired index then press [Enter] to run sample > ', 'white'));
161
+    $base = Console::text('~miShell^^', 'yellow');
162
+    $base .= Console::text(' $ ', 'gray');
163
+    $selectedIndex = Console::askInt($base.Console::text('Enter desired index then press [Enter] to run sample > ', 'white'));
164 164
     $index = getIndex();
165 165
 
166
-    switch($selectedIndex){
166
+    switch ($selectedIndex) {
167 167
         case 0: 
168 168
             Console::log();
169 169
             exit();
@@ -174,39 +174,39 @@  discard block
 block discarded – undo
174 174
 
175 175
                 $title      = $index[$selectedIndex][0];
176 176
                 $fileName   = $index[$selectedIndex][2];
177
-                $filePath   = __DIR__ . '/'. $fileName;
177
+                $filePath   = __DIR__.'/'.$fileName;
178 178
                 
179 179
                 Console::clear();
180 180
                 writeHeader();
181 181
                 writeSampleHeader($selectedIndex, $title);
182 182
 
183
-                Console::log($base . Console::text('Start running [', 'white') . 
184
-                                     Console::text( $title, 'lightcyan') . 
185
-                                     Console::text('] in file [', 'white')  .
186
-                                     Console::text( $fileName, 'lightcyan') . 
183
+                Console::log($base.Console::text('Start running [', 'white'). 
184
+                                     Console::text($title, 'lightcyan'). 
185
+                                     Console::text('] in file [', 'white').
186
+                                     Console::text($fileName, 'lightcyan'). 
187 187
                                      Console::text(']', 'white'));
188 188
 
189
-                if (file_exists($filePath)){
189
+                if (file_exists($filePath)) {
190 190
                     Console::log();
191 191
                     include $filePath;
192 192
                     Console::log();
193
-                    Console::log($base . Console::text('End running [', 'white')  .
194
-                                     Console::text( $title, 'lightcyan') . 
193
+                    Console::log($base.Console::text('End running [', 'white').
194
+                                     Console::text($title, 'lightcyan'). 
195 195
                                      Console::text(']', 'white')); 
196
-                    $response = Console::ask($base . Console::text('Do you want to see the code that has been executed? (type y/Y to see the code) > ', 'white'));
196
+                    $response = Console::ask($base.Console::text('Do you want to see the code that has been executed? (type y/Y to see the code) > ', 'white'));
197 197
                      if (strtoupper($response) === 'Y') {
198
-                        Console::log($base . Console::text('The code in file [', 'white')  .
199
-                                     Console::text( $fileName, 'lightcyan') . 
198
+                        Console::log($base.Console::text('The code in file [', 'white').
199
+                                     Console::text($fileName, 'lightcyan'). 
200 200
                                      Console::text('] is:', 'white')); 
201 201
                         Console::log();
202 202
 
203 203
                         $lines = file($filePath, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
204 204
                         $count = 1;
205
-                        foreach($lines as $line){
205
+                        foreach ($lines as $line) {
206 206
                             $codeLine = rtrim($line);
207 207
                             $isComment = substr(ltrim($codeLine), 0, 2) === '//';
208 208
                             Console::log(
209
-                                Console::pad($count . ' ', 3, ' ', STR_PAD_LEFT) . 
209
+                                Console::pad($count.' ', 3, ' ', STR_PAD_LEFT). 
210 210
                                 Console::text(Console::pad($codeLine, 150), $isComment ? 'magenta' : 'black', 'white')
211 211
                             );
212 212
                             $count++;
@@ -214,17 +214,17 @@  discard block
 block discarded – undo
214 214
                         Console::log();
215 215
                     }
216 216
                } else {
217
-                    Console::log($base . Console::text('Error' , 'red'));
218
-                    Console::log($base . Console::text(' => File missing [' . $fileName . ']' , 'red'));
217
+                    Console::log($base.Console::text('Error', 'red'));
218
+                    Console::log($base.Console::text(' => File missing ['.$fileName.']', 'red'));
219 219
                }
220 220
 
221 221
             } else {
222
-                Console::log($base . Console::text('Error:', 'red'));
223
-                Console::log($base . Console::text('=> the value you entered is not a valid index number.', 'red'));
222
+                Console::log($base.Console::text('Error:', 'red'));
223
+                Console::log($base.Console::text('=> the value you entered is not a valid index number.', 'red'));
224 224
                 askIndex();
225 225
             }
226 226
 
227
-            Console::ask($base . Console::text('Press [Enter] to go back to index > ', 'white'));
227
+            Console::ask($base.Console::text('Press [Enter] to go back to index > ', 'white'));
228 228
             goIndex();
229 229
     }
230 230
 }
231 231
\ No newline at end of file
Please login to merge, or discard this patch.