@@ -14,9 +14,9 @@ |
||
14 | 14 | |
15 | 15 | foreach (Console::getStyles()['foregrounds'] as $color => $colorValue ){ |
16 | 16 | Console::log(' '.Console::tableRow([ |
17 | - ' ' . $i => 7, |
|
17 | + ' ' . $i => 7, |
|
18 | 18 | $color => 15, |
19 | - "\\033[" . $colorValue .'m' => 15, |
|
19 | + "\\033[" . $colorValue .'m' => 15, |
|
20 | 20 | Console::text(str_pad('I am a text color={' . $color .'}', 48), $color) => 50 |
21 | 21 | ])); |
22 | 22 | $i++; |
@@ -1,5 +1,5 @@ discard block |
||
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 | |
@@ -12,12 +12,12 @@ discard block |
||
12 | 12 | |
13 | 13 | $i = 1; |
14 | 14 | |
15 | -foreach (Console::getStyles()['foregrounds'] as $color => $colorValue ){ |
|
15 | +foreach (Console::getStyles()['foregrounds'] as $color => $colorValue) { |
|
16 | 16 | Console::log(' '.Console::tableRow([ |
17 | - ' ' . $i => 7, |
|
17 | + ' '.$i => 7, |
|
18 | 18 | $color => 15, |
19 | - "\\033[" . $colorValue .'m' => 15, |
|
20 | - Console::text(str_pad('I am a text color={' . $color .'}', 48), $color) => 50 |
|
19 | + "\\033[".$colorValue.'m' => 15, |
|
20 | + Console::text(str_pad('I am a text color={'.$color.'}', 48), $color) => 50 |
|
21 | 21 | ])); |
22 | 22 | $i++; |
23 | 23 | } |
@@ -1,5 +1,5 @@ discard block |
||
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 |
||
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: |
@@ -13,9 +13,9 @@ |
||
13 | 13 | foreach (Console::getStyles()['backgrounds'] as $bgcolor => $colorValue ){ |
14 | 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, |
|
18 | + "\\033[" . $colorValue .'m' => 15, |
|
19 | 19 | Console::text(str_pad('I am a text color={' . $foregroundColor .'} on bgcolor={' . $bgcolor .'}', 48), $foregroundColor , $bgcolor) => 50 |
20 | 20 | ])); |
21 | 21 | $i++; |
@@ -1,5 +1,5 @@ discard block |
||
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 |
||
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 | } |
@@ -1,6 +1,6 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -1,5 +1,5 @@ discard block |
||
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 |
||
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 |
||
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, '*')); |
@@ -1,10 +1,10 @@ discard block |
||
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 |
||
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 |
@@ -16,13 +16,13 @@ discard block |
||
16 | 16 | |
17 | 17 | |
18 | 18 | $headerStyles = [' ' => 31, |
19 | - 'none' => 6, |
|
20 | - 'bold' => 6, |
|
21 | - 'underline' => 12, |
|
22 | - 'blink' => 7, |
|
23 | - 'reverse' => 10, |
|
24 | - ' ' => 50 |
|
25 | - ]; |
|
19 | + 'none' => 6, |
|
20 | + 'bold' => 6, |
|
21 | + 'underline' => 12, |
|
22 | + 'blink' => 7, |
|
23 | + 'reverse' => 10, |
|
24 | + ' ' => 50 |
|
25 | + ]; |
|
26 | 26 | |
27 | 27 | Console::log(' '.Console::tableRowSeparator($rowHeaders1)); |
28 | 28 | Console::log(' '.Console::tableRow($rowHeaders1)); |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | |
38 | 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, |
|
42 | + "\\033[" . $colorValue .'m' => 15, |
|
43 | 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 | - $i++; |
|
46 | + $i++; |
|
47 | 47 | } |
48 | 48 | Console::log(' '.Console::tableRowEmpty($rowHeaders1)); |
49 | 49 | Console::log(' '.Console::tableRowSeparator($rowHeaders1)); |
@@ -1,11 +1,11 @@ discard block |
||
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 |
||
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++; |
@@ -1,6 +1,6 @@ discard block |
||
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 |
||
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'); |