@@ -5,13 +5,13 @@ discard block |
||
5 | 5 | use PhpSchool\CliMenu\MenuItem\LineBreakItem; |
6 | 6 | use PhpSchool\CliMenu\MenuItem\MenuItemInterface; |
7 | 7 | |
8 | -require_once(__DIR__ . '/../vendor/autoload.php'); |
|
8 | +require_once(__DIR__.'/../vendor/autoload.php'); |
|
9 | 9 | |
10 | -$itemCallable = function (CliMenu $menu) { |
|
11 | - $colour = function () { |
|
10 | +$itemCallable = function(CliMenu $menu) { |
|
11 | + $colour = function() { |
|
12 | 12 | return array_rand(array_flip(['blue', 'green', 'red', 'yellow'])); |
13 | 13 | }; |
14 | - $int = function () { |
|
14 | + $int = function() { |
|
15 | 15 | return rand(1, 20); |
16 | 16 | }; |
17 | 17 | |
@@ -26,11 +26,11 @@ discard block |
||
26 | 26 | |
27 | 27 | $items = $menu->getItems(); |
28 | 28 | |
29 | - array_walk($items, function (MenuItemInterface $item) use ($menu) { |
|
29 | + array_walk($items, function(MenuItemInterface $item) use ($menu) { |
|
30 | 30 | $menu->removeItem($item); |
31 | 31 | }); |
32 | 32 | |
33 | - $items = array_filter($items, function (MenuItemInterface $item) { |
|
33 | + $items = array_filter($items, function(MenuItemInterface $item) { |
|
34 | 34 | return !$item instanceof LineBreakItem; |
35 | 35 | }); |
36 | 36 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | array_walk( |
43 | 43 | $items, |
44 | - function (MenuItemInterface $item) use ($menu) { |
|
44 | + function(MenuItemInterface $item) use ($menu) { |
|
45 | 45 | $menu->addItem($item); |
46 | 46 | } |
47 | 47 | ); |
@@ -4,9 +4,9 @@ |
||
4 | 4 | use PhpSchool\CliMenu\CliMenuBuilder; |
5 | 5 | use PhpSchool\CliMenu\MenuItem\MenuItem; |
6 | 6 | |
7 | -require_once(__DIR__ . '/../vendor/autoload.php'); |
|
7 | +require_once(__DIR__.'/../vendor/autoload.php'); |
|
8 | 8 | |
9 | -$itemCallable = function (CliMenu $menu) { |
|
9 | +$itemCallable = function(CliMenu $menu) { |
|
10 | 10 | echo $menu->getSelectedItem()->getText(); |
11 | 11 | }; |
12 | 12 |
@@ -75,12 +75,12 @@ |
||
75 | 75 | { |
76 | 76 | //y |
77 | 77 | $textLines = count(explode("\n", $this->text)) + 2; |
78 | - $this->y = ceil($this->parentMenu->getCurrentFrame()->count() / 2) - ceil($textLines / 2) + 1; |
|
78 | + $this->y = ceil($this->parentMenu->getCurrentFrame()->count()/2) - ceil($textLines/2) + 1; |
|
79 | 79 | |
80 | 80 | //x |
81 | 81 | $parentStyle = $this->parentMenu->getStyle(); |
82 | - $dialogueHalfLength = (mb_strlen($this->text) + ($this->style->getPadding() * 2)) / 2; |
|
83 | - $widthHalfLength = ceil($parentStyle->getWidth() / 2); |
|
82 | + $dialogueHalfLength = (mb_strlen($this->text) + ($this->style->getPadding()*2))/2; |
|
83 | + $widthHalfLength = ceil($parentStyle->getWidth()/2); |
|
84 | 84 | $this->x = $widthHalfLength - $dialogueHalfLength; |
85 | 85 | } |
86 | 86 |
@@ -35,7 +35,7 @@ |
||
35 | 35 | $this->emptyRow(); |
36 | 36 | |
37 | 37 | $confirmText = sprintf(' < %s > ', $confirmText); |
38 | - $leftFill = ($promptWidth / 2) - (mb_strlen($confirmText) / 2); |
|
38 | + $leftFill = ($promptWidth/2) - (mb_strlen($confirmText)/2); |
|
39 | 39 | |
40 | 40 | $this->write(sprintf( |
41 | 41 | '%s%s%s', |