Completed
Push — master ( 318379...7c23c1 )
by Kris
23s queued 10s
created
demo/demo.askint.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
 Console::log("   - The method returns " . Console::text("int", 'blue') . " value or " .  Console::text("false", 'blue'). " if the entered value is not a valid int number.");
10 10
 Console::log("   - You can customize colors (foreground and background) and some styles in same way than ");
11 11
 Console::log('     with ' . Console::text("Console::text()", 'lightblue', 'underlined') . 
12
-                 ' and ' .  Console::text("Console::log()", 'lightblue', 'underlined'). ' methods.');
12
+                    ' and ' .  Console::text("Console::log()", 'lightblue', 'underlined'). ' methods.');
13 13
 Console::log();
14 14
 Console::log(' '. Console::text('Usage:', 'underlined', 'bold'));
15 15
 Console::log('   ' . Console::text("\$value = Console::askInt('Please enter a number > ');", 'lightmagenta')); 
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,29 +1,29 @@
 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|bool ", 'blue') . Console::text("Console::askInt()", 'lightblue', 'underlined') . " to ask user to enter a number in the console.");
5
+Console::log(' '.Console::text('Overview:', 'underlined', 'bold'));
6
+Console::log("  - Use ".Console::text("int|bool ", 'blue').Console::text("Console::askInt()", 'lightblue', 'underlined')." to ask user to enter a number in the console.");
7 7
 Console::log();
8
-Console::log(' '. Console::text('Tips:', 'underlined', 'bold'));
9
-Console::log("   - The method returns " . Console::text("int", 'blue') . " value or " .  Console::text("false", 'blue'). " if the entered value is not a valid int number.");
8
+Console::log(' '.Console::text('Tips:', 'underlined', 'bold'));
9
+Console::log("   - The method returns ".Console::text("int", 'blue')." value or ".Console::text("false", 'blue')." if the entered value is not a valid int number.");
10 10
 Console::log("   - You can customize colors (foreground and background) and some styles in same way than ");
11
-Console::log('     with ' . Console::text("Console::text()", 'lightblue', 'underlined') . 
12
-                 ' and ' .  Console::text("Console::log()", 'lightblue', 'underlined'). ' methods.');
11
+Console::log('     with '.Console::text("Console::text()", 'lightblue', 'underlined'). 
12
+                 ' and '.Console::text("Console::log()", 'lightblue', 'underlined').' methods.');
13 13
 Console::log();
14
-Console::log(' '. Console::text('Usage:', 'underlined', 'bold'));
15
-Console::log('   ' . Console::text("\$value = Console::askInt('Please enter a number > ');", 'lightmagenta')); 
16
-Console::log('   ' . Console::text("if (\$value !== false) {", 'lightmagenta')); 
17
-Console::log('   ' . Console::text("// Do something with \$value", 'green')); 
14
+Console::log(' '.Console::text('Usage:', 'underlined', 'bold'));
15
+Console::log('   '.Console::text("\$value = Console::askInt('Please enter a number > ');", 'lightmagenta')); 
16
+Console::log('   '.Console::text("if (\$value !== false) {", 'lightmagenta')); 
17
+Console::log('   '.Console::text("// Do something with \$value", 'green')); 
18 18
 Console::log();
19
-Console::log(' '. Console::text('Sample:', 'underlined', 'bold'));
19
+Console::log(' '.Console::text('Sample:', 'underlined', 'bold'));
20 20
 
21 21
 // -----------------
22 22
 // sample start here
23 23
 // -----------------
24 24
 $value = Console::askInt('  Please enter a number > ');
25
-if ($value !== false){
26
-    Console::log('  => The value you entered is [' . Console::text($value, 'yellow') . ']');
25
+if ($value !== false) {
26
+    Console::log('  => The value you entered is ['.Console::text($value, 'yellow').']');
27 27
 } else {
28 28
     Console::log(Console::text('  Error:', 'red'));
29 29
     Console::log(Console::text('  => the value you entered is not a valid number.', 'red'));
Please login to merge, or discard this patch.
demo/demo.bell.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@
 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::bell()", 'lightblue', 'underlined') . ' to play a bell sound in console (if available).', 'white');
5
+Console::log(' '.Console::text('Overview:', 'underlined', 'bold'));
6
+Console::log('  - Use '.Console::text("Console::bell()", 'lightblue', 'underlined').' to play a bell sound in console (if available).', 'white');
7 7
 Console::log();   
8
-Console::log(' '. Console::text('Usage:', 'underlined', 'bold'));
8
+Console::log(' '.Console::text('Usage:', 'underlined', 'bold'));
9 9
 Console::log();   
10
-Console::log('   ' .Console::text('// Play the bell', 'green'));
11
-Console::log('   ' .Console::text('Console::bell();', 'lightmagenta'));
10
+Console::log('   '.Console::text('// Play the bell', 'green'));
11
+Console::log('   '.Console::text('Console::bell();', 'lightmagenta'));
12 12
 Console::log();   
13
-Console::log(' '. Console::text('Sample:', 'underlined', 'bold'));
13
+Console::log(' '.Console::text('Sample:', 'underlined', 'bold'));
14 14
 
15 15
 // -----------------
16 16
 // sample start here
Please login to merge, or discard this patch.
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.colors.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,9 +12,9 @@
 block discarded – undo
12 12
 $i = 1;
13 13
 foreach (Console::getStyles()['foregrounds'] as $color => $colorValue ){
14 14
     Console::log('  '.Console::tableRow([
15
-       ' ' . $i     => 7,
15
+        ' ' . $i     => 7,
16 16
         $color        => 15, 
17
-       "\\033[" . $colorValue  .'m'  => 15, 
17
+        "\\033[" . $colorValue  .'m'  => 15, 
18 18
         Console::text(str_pad('I am a text color={' . $color .'}', 48), $color) => 50
19 19
     ]));
20 20
     $i++;
Please login to merge, or discard this 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
 // headers
@@ -10,12 +10,12 @@  discard block
 block discarded – undo
10 10
 
11 11
 // loop into foregrounds
12 12
 $i = 1;
13
-foreach (Console::getStyles()['foregrounds'] as $color => $colorValue ){
13
+foreach (Console::getStyles()['foregrounds'] as $color => $colorValue) {
14 14
     Console::log('  '.Console::tableRow([
15
-       ' ' . $i     => 7,
15
+       ' '.$i     => 7,
16 16
         $color        => 15, 
17
-       "\\033[" . $colorValue  .'m'  => 15, 
18
-        Console::text(str_pad('I am a text color={' . $color .'}', 48), $color) => 50
17
+       "\\033[".$colorValue.'m'  => 15, 
18
+        Console::text(str_pad('I am a text color={'.$color.'}', 48), $color) => 50
19 19
     ]));
20 20
     $i++;
21 21
 }
Please login to merge, or discard this patch.
demo/demo.table.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@
 block discarded – undo
109 109
 Console::$horizontalSeparator = '-';            // change the horizontal separator
110 110
 Console::$tableCellPadding = '';                // no padding 
111 111
 Console::$verticalInnerSeparator = '   ';       // blank separator
112
-     Console::$verticalSeparator = '   ';       // no top left/right separator except a margin..
112
+        Console::$verticalSeparator = '   ';       // no top left/right separator except a margin..
113 113
 // Console::$verticalHeaderSeparator = '';      // no top left/right separator (not needed)
114 114
 
115 115
 // table start
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 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',   'white'),     
47
+        Console::text('foo', 'white'),     
48 48
         Console::text('some centered text red for foo', 'red')
49 49
     ],
50 50
     [
51
-        Console::text('bar',   'white'),     
52
-        Console::text( 'some centered text green for bar', 'green')
51
+        Console::text('bar', 'white'),     
52
+        Console::text('some centered text green for bar', 'green')
53 53
     ],
54 54
     [
55 55
         Console::text('foobar', 'white'),    
56
-        'some text with unicode ✓ ' .Console::text('on BLUE here', 'white', 'blue')  
56
+        'some text with unicode ✓ '.Console::text('on BLUE here', 'white', 'blue')  
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
 
@@ -91,38 +91,38 @@  discard block
 block discarded – undo
91 91
 // ------ ANOTHER STYLE  ---------
92 92
 // -------------------------------
93 93
 Console::log();
94
-Console::log(' ' . Console::text('Another style sample', 'white', 'underlined'));
94
+Console::log(' '.Console::text('Another style sample', 'white', 'underlined'));
95 95
 Console::log();
96 96
 
97 97
 $rowHeaders = [
98
-    Console::text('Item',           'darkgray')    => 10, 
99
-    Console::text('Status',         'darkgray')    => 12,
100
-    Console::text('Description',    'darkgray')    => 25
98
+    Console::text('Item', 'darkgray')    => 10, 
99
+    Console::text('Status', 'darkgray')    => 12,
100
+    Console::text('Description', 'darkgray')    => 25
101 101
 ];
102 102
 $rows = [
103
-    [Console::text('foo',     'white'), Console::text(' ONLINE ',  'white', 'green') , Console::text('some text for foo',    'white')],
104
-    [Console::text('bar',     'white'), Console::text(' ONLINE ',  'white', 'green') , Console::text('some text for bar',    'white')],
105
-    [Console::text('foobar ', 'white'), Console::text(' OFFLINE ', 'white', 'red')   , Console::text('some text for foobar', 'white')]
103
+    [Console::text('foo', 'white'), Console::text(' ONLINE ', 'white', 'green'), Console::text('some text for foo', 'white')],
104
+    [Console::text('bar', 'white'), Console::text(' ONLINE ', 'white', 'green'), Console::text('some text for bar', 'white')],
105
+    [Console::text('foobar ', 'white'), Console::text(' OFFLINE ', 'white', 'red'), Console::text('some text for foobar', 'white')]
106 106
 ];
107 107
 
108
-Console::$horizontalSeparator = '-';            // change the horizontal separator
109
-Console::$tableCellPadding = '';                // no padding 
110
-Console::$verticalInnerSeparator = '   ';       // blank separator
111
-     Console::$verticalSeparator = '   ';       // no top left/right separator except a margin..
108
+Console::$horizontalSeparator = '-'; // change the horizontal separator
109
+Console::$tableCellPadding = ''; // no padding 
110
+Console::$verticalInnerSeparator = '   '; // blank separator
111
+     Console::$verticalSeparator = '   '; // no top left/right separator except a margin..
112 112
 // Console::$verticalHeaderSeparator = '';      // no top left/right separator (not needed)
113 113
 
114 114
 // table start
115 115
 Console::log(Console::tableRowSeparator($rowHeaders, 'drakgray')); // saparator            ---------   ---------   ---  
116
-Console::log(Console::tableRow($rowHeaders, 'drakgray'));          // columns headers      foo         bar         f... 
116
+Console::log(Console::tableRow($rowHeaders, 'drakgray')); // columns headers      foo         bar         f... 
117 117
 Console::log(Console::tableRowSeparator($rowHeaders, 'drakgray')); // saparator            ---------   ---------   ---  
118 118
 
119 119
 // tables rows
120
-foreach ($rows as $row){
120
+foreach ($rows as $row) {
121 121
     Console::log(
122
-        Console::TableRowStart().           // start row with separator. Then, each cell will end with a separator 
123
-        Console::TableRowCell($row[0] , 10).   // keep align right left
124
-        Console::TableRowCell($row[1] , 12, Console::ALIGN_CENTER).  // align center
125
-        Console::TableRowCell($row[2] , 25)  // keep align right left
122
+        Console::TableRowStart().// start row with separator. Then, each cell will end with a separator 
123
+        Console::TableRowCell($row[0], 10).// keep align right left
124
+        Console::TableRowCell($row[1], 12, Console::ALIGN_CENTER).// align center
125
+        Console::TableRowCell($row[2], 25)  // keep align right left
126 126
     );
127 127
 }
128 128
 // table end
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 formatted text
140
+                return self::getCliString($str, $args); // get formatted 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 static function pad($input, $padLength, $padString = ' ', $padType = STR_PAD_RIGHT)
358 358
     {
359
-        $diff = $padLength - mb_strlen(preg_replace('#\\033\[[[0-9;*]{1,}m#', '', $input));
359
+        $diff = $padLength-mb_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/ShellTablePrinter.php 2 patches
Indentation   +8 added lines, -8 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
     /**
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
      */
107 107
     public static $verticalHeaderSeparator   = '+';
108 108
 
109
-   /**
109
+    /**
110 110
      * The vertical separator sign. 
111 111
      *
112 112
      * @access public
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
      *
258 258
      * @return string          
259 259
      */
260
-     public static function tableRow()
260
+        public static function tableRow()
261 261
     {
262 262
         // get and parse arguments:
263 263
         //  - extract first argument (columns list)
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 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 header separator sign. 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
      * @access public
105 105
      * @var    string
106 106
      */
107
-    public static $verticalHeaderSeparator   = '+';
107
+    public static $verticalHeaderSeparator = '+';
108 108
 
109 109
    /**
110 110
      * The vertical separator sign. 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
      * @access public
113 113
      * @var    string
114 114
      */
115
-    public static $verticalInnerSeparator   = '+';
115
+    public static $verticalInnerSeparator = '+';
116 116
            
117 117
     /**
118 118
      * Resets the default options
@@ -148,13 +148,13 @@  discard block
 block discarded – undo
148 148
         $columnsPads = !empty($args) ? $args[0] : [];
149 149
         array_shift($args);
150 150
 
151
-        $str = self::$verticalSeparator ;
152
-        $cellPaddingLenght = mb_strlen(self::$tableCellPadding) *2;
153
-        foreach ($columnsPads as $key => $pad){
154
-            $str .= str_repeat(self::$horizontalSeparator , $pad + $cellPaddingLenght) .self::$verticalInnerSeparator;
151
+        $str = self::$verticalSeparator;
152
+        $cellPaddingLenght = mb_strlen(self::$tableCellPadding)*2;
153
+        foreach ($columnsPads as $key => $pad) {
154
+            $str .= str_repeat(self::$horizontalSeparator, $pad+$cellPaddingLenght).self::$verticalInnerSeparator;
155 155
         }
156 156
 
157
-        return self::getCliString(self::$verticalInnerSeparator === '' ? $str : substr($str, 0, mb_strlen($str) -1). self::$verticalSeparator, $args);
157
+        return self::getCliString(self::$verticalInnerSeparator === '' ? $str : substr($str, 0, mb_strlen($str)-1).self::$verticalSeparator, $args);
158 158
     }
159 159
 
160 160
     /**
@@ -174,12 +174,12 @@  discard block
 block discarded – undo
174 174
         $columnsPads = !empty($args) ? $args[0] : [];
175 175
         array_shift($args);
176 176
 
177
-        $str = self::$verticalHeaderSeparator ;
178
-        $cellPaddingLenght = mb_strlen(self::$tableCellPadding) *2;
179
-        foreach ($columnsPads as $key => $pad){
180
-            $str .= str_repeat(self::$horizontalSeparator , $pad + $cellPaddingLenght) .self::$verticalInnerSeparator ;
177
+        $str = self::$verticalHeaderSeparator;
178
+        $cellPaddingLenght = mb_strlen(self::$tableCellPadding)*2;
179
+        foreach ($columnsPads as $key => $pad) {
180
+            $str .= str_repeat(self::$horizontalSeparator, $pad+$cellPaddingLenght).self::$verticalInnerSeparator;
181 181
         }
182
-        return self::getCliString(self::$verticalInnerSeparator === '' ? $str : substr($str, 0, mb_strlen($str) -1). self::$verticalHeaderSeparator, $args);
182
+        return self::getCliString(self::$verticalInnerSeparator === '' ? $str : substr($str, 0, mb_strlen($str)-1).self::$verticalHeaderSeparator, $args);
183 183
 
184 184
     }
185 185
 
@@ -203,12 +203,12 @@  discard block
 block discarded – undo
203 203
         $columnsPads = !empty($args) ? $args[0] : [];
204 204
         array_shift($args);
205 205
 
206
-        $str = self::$verticalSeparator ;
207
-        foreach ($columnsPads as $pad){
206
+        $str = self::$verticalSeparator;
207
+        foreach ($columnsPads as $pad) {
208 208
             $str .= self::$tableCellPadding. 
209 209
                     str_pad(' ', $pad).
210 210
                     self::$tableCellPadding. 
211
-                    self::$verticalSeparator ;
211
+                    self::$verticalSeparator;
212 212
         }
213 213
         return self::getCliString($str, $args);
214 214
     }
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
         $str = self::$verticalSeparator;
272 272
 
273 273
         // add columns        
274
-        foreach ($columns as $column => $pad){
274
+        foreach ($columns as $column => $pad) {
275 275
             $str .= self::$tableCellPadding. 
276 276
                     self::pad($column, $pad).
277 277
                     self::$tableCellPadding.
@@ -279,6 +279,6 @@  discard block
 block discarded – undo
279 279
         }
280 280
 
281 281
         // format full row
282
-        return self::getCliString($str, $args) ; 
282
+        return self::getCliString($str, $args); 
283 283
     }
284 284
 }
285 285
\ No newline at end of file
Please login to merge, or discard this patch.
lib/Program.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      */
48 48
     public 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,7 +65,7 @@  discard block
 block discarded – undo
65 65
      */
66 66
     public static function getArgumentValue(array $arguments, string $shortArg, string $longArg):? string
67 67
     {
68
-          return array_key_exists($shortArg, $arguments) ? $arguments[$shortArg] : 
68
+            return array_key_exists($shortArg, $arguments) ? $arguments[$shortArg] : 
69 69
                  (array_key_exists($longArg, $arguments) ? $arguments[$longArg]  : null);
70 70
     }
71 71
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -63,10 +63,9 @@
 block discarded – undo
63 63
      * @return string|null   
64 64
      * 
65 65
      */
66
-    public static function getArgumentValue(array $arguments, string $shortArg, string $longArg):? string
66
+    public static function getArgumentValue(array $arguments, string $shortArg, string $longArg): ? string
67 67
     {
68
-          return array_key_exists($shortArg, $arguments) ? $arguments[$shortArg] : 
69
-                 (array_key_exists($longArg, $arguments) ? $arguments[$longArg]  : null);
68
+          return array_key_exists($shortArg, $arguments) ? $arguments[$shortArg] : (array_key_exists($longArg, $arguments) ? $arguments[$longArg] : null);
70 69
     }
71 70
 
72 71
 }
73 72
\ No newline at end of file
Please login to merge, or discard this patch.