@@ -3,13 +3,13 @@ |
||
| 3 | 3 | use PhpSchool\CliMenu\CliMenu; |
| 4 | 4 | use PhpSchool\CliMenu\CliMenuBuilder; |
| 5 | 5 | |
| 6 | -require_once(__DIR__ . '/../vendor/autoload.php'); |
|
| 6 | +require_once(__DIR__.'/../vendor/autoload.php'); |
|
| 7 | 7 | |
| 8 | -$itemCallable = function (CliMenu $menu) { |
|
| 8 | +$itemCallable = function(CliMenu $menu) { |
|
| 9 | 9 | $menu->confirm(sprintf('switch [%s]?!', 6789)) |
| 10 | 10 | ->setYesText('OK') |
| 11 | 11 | ->setNoText('Cancel') |
| 12 | - ->show(function ($res) { |
|
| 12 | + ->show(function($res) { |
|
| 13 | 13 | var_dump($res); |
| 14 | 14 | }); |
| 15 | 15 | }; |
@@ -66,8 +66,8 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | $promptWidth = mb_strlen($this->text) + 4; |
| 68 | 68 | $fillWidth = $promptWidth - (mb_strlen($this->getYesText()) + mb_strlen($this->getNoText())); |
| 69 | - $placeHolderWidth = 0 == ($fillWidth % 2) ? 2 : 1;//中间位宽度 |
|
| 70 | - $fillWidth = ($fillWidth - $placeHolderWidth) / 2; |
|
| 69 | + $placeHolderWidth = 0 == ($fillWidth%2) ? 2 : 1; //中间位宽度 |
|
| 70 | + $fillWidth = ($fillWidth - $placeHolderWidth)/2; |
|
| 71 | 71 | |
| 72 | 72 | $this->write(sprintf( |
| 73 | 73 | '%s%s%s', |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | $this->emptyRow(); |
| 167 | 167 | |
| 168 | 168 | $confirmText = sprintf(' < %s > ', $confirmText); |
| 169 | - $leftFill = ($promptWidth / 2) - (mb_strlen($confirmText) / 2); |
|
| 169 | + $leftFill = ($promptWidth/2) - (mb_strlen($confirmText)/2); |
|
| 170 | 170 | |
| 171 | 171 | $this->write(sprintf( |
| 172 | 172 | '%s%s%s', |