1 | <?php |
||
2 | require_once __DIR__ .'/../vendor/autoload.php'; |
||
3 | use Kristuff\Mishell\Console; |
||
4 | |||
5 | console::resetDefaults(); |
||
6 | |||
7 | Console::log(' ' . Console::text('Basic sample', 'white', 'underlined')); |
||
8 | Console::log(); |
||
9 | |||
10 | $rowHeaders = ['Index' => 10, 'Item' => 25, 'Description' => 50]; |
||
11 | $rows = [ |
||
12 | ['foo', 'some text for foo'], |
||
13 | ['bar', 'some text for bar'], |
||
14 | ['foobar', 'some text for foobar'] |
||
15 | ]; |
||
16 | Console::log(Console::tableSeparator($rowHeaders)); |
||
17 | Console::log(Console::tableRow($rowHeaders)); |
||
18 | Console::log(Console::tableRowSeparator($rowHeaders)); |
||
19 | |||
20 | foreach ($rows as $key => $value){ |
||
21 | Console::log(Console::tableRow([ |
||
22 | $key => 10, |
||
23 | $rows[$key][0] => 25, |
||
24 | $rows[$key][1] => 50 |
||
25 | ])); |
||
26 | } |
||
27 | Console::log(Console::tableSeparator($rowHeaders)); |
||
28 | |||
29 | Console::log(); |
||
30 | Console::log(); |
||
31 | |||
32 | |||
33 | |||
34 | // ------------------------------- |
||
35 | // ------ ADVANCED SAMPLE -------- |
||
36 | // ------------------------------- |
||
37 | Console::log(' ' . Console::text('Advanced sample', 'white', 'underlined')); |
||
38 | Console::log(); |
||
39 | |||
40 | $rowHeaders = [ |
||
41 | Console::text('Index', 'blue') => 10, |
||
42 | Console::text('Item', 'white', 'underlined') => 25, |
||
43 | Console::text('Description', 'white') => 50 |
||
44 | ]; |
||
45 | $rows = [ |
||
46 | [ |
||
47 | Console::text('foo', 'white'), |
||
48 | Console::text('some centered text red for foo', 'red') |
||
49 | ], |
||
50 | [ |
||
51 | Console::text('bar', 'white'), |
||
52 | Console::text( 'some centered text green for bar', 'green') |
||
53 | ], |
||
54 | [ |
||
55 | Console::text('foobar', 'white'), |
||
56 | 'some text with unicode ✓ ' .Console::text('on BLUE here', 'white', 'blue') |
||
57 | ] |
||
58 | ]; |
||
59 | |||
60 | |||
61 | |||
62 | //Console::$verticalSeparator = '!'; // change the vertical separator |
||
63 | //Console::$verticalInnerSeparator = '!'; // change the vertical inner separator |
||
64 | //Console::$horizontalSeparator = '_'; // change the horizontal separator |
||
65 | |||
66 | Console::$tableCellPadding = ' '; // increase cell padding to 2 white chars (default is 1) |
||
67 | |||
68 | // table start |
||
69 | Console::log(Console::tableSeparator($rowHeaders)); // top line |----------------------- ... |
||
70 | Console::log(Console::tableRow($rowHeaders)); // columns headers | foo | bar |--- ... |
||
71 | Console::log(Console::tableRowSeparator($rowHeaders)); // saparator |---------|---------|--- ... |
||
72 | Console::log(Console::tableRowEmpty($rowHeaders)); // empty row | | | ... |
||
73 | |||
74 | // tables rows |
||
75 | foreach ($rows as $key => $value){ |
||
76 | |||
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 |
||
82 | ); |
||
83 | } |
||
84 | |||
85 | // table end |
||
86 | Console::log(Console::tableRowEmpty($rowHeaders)); // empty row | | | ... |
||
87 | Console::log(Console::tableSeparator($rowHeaders)); // saparator |----------------------- ... |
||
88 | console::resetDefaults(); |
||
89 | |||
90 | // ------------------------------- |
||
91 | // ------ ANOTHER STYLE --------- |
||
92 | // ------------------------------- |
||
93 | Console::log(); |
||
94 | Console::log(' ' . Console::text('Another style sample', 'white', 'underlined')); |
||
95 | Console::log(); |
||
96 | |||
97 | $rowHeaders = [ |
||
98 | Console::text('Item', 'darkgray') => 10, |
||
99 | Console::text('Status', 'darkgray') => 12, |
||
100 | Console::text('Description', 'darkgray') => 25 |
||
101 | //✓✗ |
||
102 | ]; |
||
103 | $rows = [ |
||
104 | [Console::text('foo', 'white'), Console::text(' ONLINE ', 'white', 'green') , Console::text('some text for foo', 'white')], |
||
105 | [Console::text('bar', 'white'), Console::text(' ONLINE ', 'white', 'green') , Console::text('some text for bar', 'white')], |
||
106 | [Console::text('foobar ', 'white'), Console::text(' OFFLINE ', 'white', 'red') , Console::text('some text for foobar', 'white')] |
||
107 | ]; |
||
108 | |||
109 | Console::$horizontalSeparator = '-'; // change the horizontal separator |
||
110 | Console::$tableCellPadding = ''; // no padding |
||
111 | Console::$verticalInnerSeparator = ' '; // blank separator |
||
112 | Console::$verticalSeparator = ' '; // no top left/right separator except a margin.. |
||
113 | // Console::$verticalHeaderSeparator = ''; // no top left/right separator (not needed) |
||
114 | |||
115 | // table start |
||
116 | Console::log(Console::tableRowSeparator($rowHeaders, 'drakgray')); // saparator --------- --------- --- |
||
117 | Console::log(Console::tableRow($rowHeaders, 'drakgray')); // columns headers foo bar f... |
||
118 | Console::log(Console::tableRowSeparator($rowHeaders, 'drakgray')); // saparator --------- --------- --- |
||
119 | |||
120 | // tables rows |
||
121 | foreach ($rows as $row){ |
||
122 | Console::log( |
||
123 | Console::TableRowStart(). // start row with separator. Then, each cell will end with a separator |
||
0 ignored issues
–
show
|
|||
124 | Console::TableRowCell($row[0] , 10). // keep align right left |
||
125 | Console::TableRowCell($row[1] , 12, Console::ALIGN_CENTER). // align center |
||
126 | Console::TableRowCell($row[2] , 25) // keep align right left |
||
127 | ); |
||
128 | } |
||
129 | // table end |
||
130 | Console::log(Console::tableRowSeparator($rowHeaders, 'drakgray')); // saparator --------- --------- --- |
||
131 | console::resetDefaults(); |
||
132 | |||
133 | |||
134 | ?> |
||
135 |
This check looks for function or method calls that always return null and whose return value is used.
The method
getObject()
can return nothing but null, so it makes no sense to use the return value.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.