Passed
Push — master ( e80252...a999dd )
by Nikolay
32:05 queued 14:50
created
etc/rc/vendor/php-school/cli-menu/src/Input/InputIO.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
     {
110 110
         return max(
111 111
             array_map(
112
-                function (string $line) {
112
+                function(string $line) {
113 113
                     return mb_strlen($line);
114 114
                 },
115 115
                 $lines
@@ -121,14 +121,14 @@  discard block
 block discarded – undo
121 121
     {
122 122
         $lines = 5; //1. empty 2. prompt text 3. empty 4. input 5. empty
123 123
 
124
-        return (int) (ceil($this->parentMenu->getCurrentFrame()->count() / 2) - ceil($lines /2) + 1);
124
+        return (int) (ceil($this->parentMenu->getCurrentFrame()->count() / 2) - ceil($lines / 2) + 1);
125 125
     }
126 126
 
127 127
     private function calculateYPositionWithError() : int
128 128
     {
129 129
         $lines = 7; //1. empty 2. prompt text 3. empty 4. input 5. empty 6. error 7. empty
130 130
 
131
-        return (int) (ceil($this->parentMenu->getCurrentFrame()->count() / 2) - ceil($lines /2) + 1);
131
+        return (int) (ceil($this->parentMenu->getCurrentFrame()->count() / 2) - ceil($lines / 2) + 1);
132 132
     }
133 133
 
134 134
     private function calculateXPosition(Input $input, string $userInput) : int
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -109,7 +109,8 @@
 block discarded – undo
109 109
     {
110 110
         return max(
111 111
             array_map(
112
-                function (string $line) {
112
+                function (string $line)
113
+                {
113 114
                     return mb_strlen($line);
114 115
                 },
115 116
                 $lines
Please login to merge, or discard this patch.
etc/rc/vendor/php-school/cli-menu/src/Input/Number.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -97,11 +97,11 @@
 block discarded – undo
97 97
 
98 98
     public function ask() : InputResult
99 99
     {
100
-        $this->inputIO->registerControlCallback(InputCharacter::UP, function (string $input) {
100
+        $this->inputIO->registerControlCallback(InputCharacter::UP, function(string $input) {
101 101
             return $this->validate($input) ? (int) $input + 1 : $input;
102 102
         });
103 103
 
104
-        $this->inputIO->registerControlCallback(InputCharacter::DOWN, function (string $input) {
104
+        $this->inputIO->registerControlCallback(InputCharacter::DOWN, function(string $input) {
105 105
             return $this->validate($input) ? (int) $input - 1 : $input;
106 106
         });
107 107
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -97,11 +97,13 @@
 block discarded – undo
97 97
 
98 98
     public function ask() : InputResult
99 99
     {
100
-        $this->inputIO->registerControlCallback(InputCharacter::UP, function (string $input) {
100
+        $this->inputIO->registerControlCallback(InputCharacter::UP, function (string $input)
101
+        {
101 102
             return $this->validate($input) ? (int) $input + 1 : $input;
102 103
         });
103 104
 
104
-        $this->inputIO->registerControlCallback(InputCharacter::DOWN, function (string $input) {
105
+        $this->inputIO->registerControlCallback(InputCharacter::DOWN, function (string $input)
106
+        {
105 107
             return $this->validate($input) ? (int) $input - 1 : $input;
106 108
         });
107 109
 
Please login to merge, or discard this patch.
etc/rc/vendor/php-school/cli-menu/src/CliMenu.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
      */
131 131
     protected function configureTerminal() : void
132 132
     {
133
-        if(!$this->terminal->isInteractive()){
133
+        if (!$this->terminal->isInteractive()) {
134 134
             sleep(1);
135 135
             exit(3);
136 136
         }
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
                 : $this->selectedItem++;
354 354
 
355 355
             if ($this->selectedItem !== null && !array_key_exists($this->selectedItem, $this->items)) {
356
-                $this->selectedItem  = $direction === 'UP'
356
+                $this->selectedItem = $direction === 'UP'
357 357
                     ? (int) end($itemKeys)
358 358
                     : (int) reset($itemKeys);
359 359
             }
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
             $frame->addRows($this->drawMenuItem(new LineBreakItem($this->style->getTitleSeparator())));
524 524
         }
525 525
 
526
-        array_map(function ($item, $index) use ($frame) {
526
+        array_map(function($item, $index) use ($frame) {
527 527
             $frame->addRows($this->drawMenuItem($item, $index === $this->selectedItem));
528 528
         }, $this->items, array_keys($this->items));
529 529
 
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
             $borderColour = '';
575 575
         }
576 576
 
577
-        return array_map(function ($row) use ($invertedColoursSetCode, $invertedColoursUnsetCode, $borderColour) {
577
+        return array_map(function($row) use ($invertedColoursSetCode, $invertedColoursUnsetCode, $borderColour) {
578 578
             return sprintf(
579 579
                 "%s%s%s%s%s%s%s%s%s%s%s%s\n",
580 580
                 str_repeat(' ', $this->style->getMargin()),
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -523,7 +523,8 @@  discard block
 block discarded – undo
523 523
             $frame->addRows($this->drawMenuItem(new LineBreakItem($this->style->getTitleSeparator())));
524 524
         }
525 525
 
526
-        array_map(function ($item, $index) use ($frame) {
526
+        array_map(function ($item, $index) use ($frame)
527
+        {
527 528
             $frame->addRows($this->drawMenuItem($item, $index === $this->selectedItem));
528 529
         }, $this->items, array_keys($this->items));
529 530
 
@@ -574,7 +575,8 @@  discard block
 block discarded – undo
574 575
             $borderColour = '';
575 576
         }
576 577
 
577
-        return array_map(function ($row) use ($invertedColoursSetCode, $invertedColoursUnsetCode, $borderColour) {
578
+        return array_map(function ($row) use ($invertedColoursSetCode, $invertedColoursUnsetCode, $borderColour)
579
+        {
578 580
             return sprintf(
579 581
                 "%s%s%s%s%s%s%s%s%s%s%s%s\n",
580 582
                 str_repeat(' ', $this->style->getMargin()),
Please login to merge, or discard this patch.
etc/rc/vendor/php-school/cli-menu/src/Builder/CliMenuBuilder.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 
253 253
     private function processItemShortcut(MenuItemInterface $item) : void
254 254
     {
255
-        $this->processIndividualShortcut($item, function (CliMenu $menu) use ($item) {
255
+        $this->processIndividualShortcut($item, function(CliMenu $menu) use ($item) {
256 256
             $menu->executeAsSelected($item);
257 257
         });
258 258
     }
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
     private function processSplitItemShortcuts(SplitItem $splitItem) : void
261 261
     {
262 262
         foreach ($splitItem->getItems() as $item) {
263
-            $this->processIndividualShortcut($item, function (CliMenu $menu) use ($splitItem, $item) {
263
+            $this->processIndividualShortcut($item, function(CliMenu $menu) use ($splitItem, $item) {
264 264
                 $current = $splitItem->getSelectedItemIndex();
265 265
 
266 266
                 $splitItem->setSelectedItemIndex(
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 
504 504
     private function itemsHaveExtra(array $items) : bool
505 505
     {
506
-        return !empty(array_filter($items, function (MenuItemInterface $item) {
506
+        return !empty(array_filter($items, function(MenuItemInterface $item) {
507 507
             return $item->showsItemExtra();
508 508
         }));
509 509
     }
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -252,7 +252,8 @@  discard block
 block discarded – undo
252 252
 
253 253
     private function processItemShortcut(MenuItemInterface $item) : void
254 254
     {
255
-        $this->processIndividualShortcut($item, function (CliMenu $menu) use ($item) {
255
+        $this->processIndividualShortcut($item, function (CliMenu $menu) use ($item)
256
+        {
256 257
             $menu->executeAsSelected($item);
257 258
         });
258 259
     }
@@ -260,7 +261,8 @@  discard block
 block discarded – undo
260 261
     private function processSplitItemShortcuts(SplitItem $splitItem) : void
261 262
     {
262 263
         foreach ($splitItem->getItems() as $item) {
263
-            $this->processIndividualShortcut($item, function (CliMenu $menu) use ($splitItem, $item) {
264
+            $this->processIndividualShortcut($item, function (CliMenu $menu) use ($splitItem, $item)
265
+            {
264 266
                 $current = $splitItem->getSelectedItemIndex();
265 267
 
266 268
                 $splitItem->setSelectedItemIndex(
@@ -503,7 +505,8 @@  discard block
 block discarded – undo
503 505
 
504 506
     private function itemsHaveExtra(array $items) : bool
505 507
     {
506
-        return !empty(array_filter($items, function (MenuItemInterface $item) {
508
+        return !empty(array_filter($items, function (MenuItemInterface $item)
509
+        {
507 510
             return $item->showsItemExtra();
508 511
         }));
509 512
     }
Please login to merge, or discard this patch.
etc/rc/vendor/php-school/cli-menu/src/MenuItem/SplitItem.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
         $missingLength = $style->getContentWidth() % $numberOfItems;
137 137
         
138 138
         return $this->buildRows(
139
-            mapWithKeys($this->items, function (int $index, MenuItemInterface $item) use ($selected, $length, $style) {
139
+            mapWithKeys($this->items, function(int $index, MenuItemInterface $item) use ($selected, $length, $style) {
140 140
                 $isSelected = $selected && $index === $this->selectedItemIndex;
141 141
 
142 142
                 if ($item instanceof CheckboxItem || $item instanceof RadioItem) {
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
         $extraPadLength = $largestItemExtra > 0 ? 2 + $largestItemExtra : 0;
185 185
         
186 186
         return array_map(
187
-            function ($i) use ($cells, $length, $missingLength, $extraPadLength) {
187
+            function($i) use ($cells, $length, $missingLength, $extraPadLength) {
188 188
                 return $this->buildRow($cells, $i, $length, $missingLength, $extraPadLength);
189 189
             },
190 190
             range(0, max(array_map('count', $cells)) - 1)
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
             implode(
199 199
                 '',
200 200
                 array_map(
201
-                    function ($cell) use ($index, $length, $extraPadLength) {
201
+                    function($cell) use ($index, $length, $extraPadLength) {
202 202
                         return $cell[$index] ?? str_repeat(' ', $length + $this->gutter + $extraPadLength);
203 203
                     },
204 204
                     $cells
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
         bool $isSelected,
216 216
         string $itemExtra
217 217
     ) : array {
218
-        return array_map(function ($row, $index) use ($length, $style, $isSelected, $itemExtra) {
218
+        return array_map(function($row, $index) use ($length, $style, $isSelected, $itemExtra) {
219 219
             $invertedColoursSetCode = $isSelected
220 220
                 ? $style->getInvertedColoursSetCode()
221 221
                 : '';
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -136,7 +136,8 @@  discard block
 block discarded – undo
136 136
         $missingLength = $style->getContentWidth() % $numberOfItems;
137 137
         
138 138
         return $this->buildRows(
139
-            mapWithKeys($this->items, function (int $index, MenuItemInterface $item) use ($selected, $length, $style) {
139
+            mapWithKeys($this->items, function (int $index, MenuItemInterface $item) use ($selected, $length, $style)
140
+            {
140 141
                 $isSelected = $selected && $index === $this->selectedItemIndex;
141 142
 
142 143
                 if ($item instanceof CheckboxItem || $item instanceof RadioItem) {
@@ -184,7 +185,8 @@  discard block
 block discarded – undo
184 185
         $extraPadLength = $largestItemExtra > 0 ? 2 + $largestItemExtra : 0;
185 186
         
186 187
         return array_map(
187
-            function ($i) use ($cells, $length, $missingLength, $extraPadLength) {
188
+            function ($i) use ($cells, $length, $missingLength, $extraPadLength)
189
+            {
188 190
                 return $this->buildRow($cells, $i, $length, $missingLength, $extraPadLength);
189 191
             },
190 192
             range(0, max(array_map('count', $cells)) - 1)
@@ -198,7 +200,8 @@  discard block
 block discarded – undo
198 200
             implode(
199 201
                 '',
200 202
                 array_map(
201
-                    function ($cell) use ($index, $length, $extraPadLength) {
203
+                    function ($cell) use ($index, $length, $extraPadLength)
204
+                    {
202 205
                         return $cell[$index] ?? str_repeat(' ', $length + $this->gutter + $extraPadLength);
203 206
                     },
204 207
                     $cells
@@ -215,7 +218,8 @@  discard block
 block discarded – undo
215 218
         bool $isSelected,
216 219
         string $itemExtra
217 220
     ) : array {
218
-        return array_map(function ($row, $index) use ($length, $style, $isSelected, $itemExtra) {
221
+        return array_map(function ($row, $index) use ($length, $style, $isSelected, $itemExtra)
222
+        {
219 223
             $invertedColoursSetCode = $isSelected
220 224
                 ? $style->getInvertedColoursSetCode()
221 225
                 : '';
Please login to merge, or discard this patch.
etc/rc/vendor/php-school/cli-menu/src/MenuItem/AsciiArtItem.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
         Assertion::inArray($position, [self::POSITION_CENTER, self::POSITION_RIGHT, self::POSITION_LEFT]);
49 49
 
50 50
         $this->setText($text);
51
-        $this->position  = $position;
51
+        $this->position = $position;
52 52
         $this->alternateText = $alt;
53 53
     }
54 54
 
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 
65 65
         $padding = $style->getContentWidth() - $this->artLength;
66 66
 
67
-        return array_map(function ($row) use ($padding) {
67
+        return array_map(function($row) use ($padding) {
68 68
             switch ($this->position) {
69 69
                 case self::POSITION_LEFT:
70 70
                     break;
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
      */
112 112
     public function setText(string $text) : void
113 113
     {
114
-        $this->text = implode("\n", array_map(function (string $line) {
114
+        $this->text = implode("\n", array_map(function(string $line) {
115 115
             return rtrim($line, ' ');
116 116
         }, explode("\n", $text)));
117 117
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -64,7 +64,8 @@  discard block
 block discarded – undo
64 64
 
65 65
         $padding = $style->getContentWidth() - $this->artLength;
66 66
 
67
-        return array_map(function ($row) use ($padding) {
67
+        return array_map(function ($row) use ($padding)
68
+        {
68 69
             switch ($this->position) {
69 70
                 case self::POSITION_LEFT:
70 71
                     break;
@@ -111,7 +112,8 @@  discard block
 block discarded – undo
111 112
      */
112 113
     public function setText(string $text) : void
113 114
     {
114
-        $this->text = implode("\n", array_map(function (string $line) {
115
+        $this->text = implode("\n", array_map(function (string $line)
116
+        {
115 117
             return rtrim($line, ' ');
116 118
         }, explode("\n", $text)));
117 119
 
Please login to merge, or discard this patch.
etc/rc/vendor/php-school/cli-menu/src/MenuItem/MenuMenuItem.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
             )
77 77
         );
78 78
 
79
-        return mapWithKeys($rows, function (int $key, string $row) use ($style, $length) {
79
+        return mapWithKeys($rows, function(int $key, string $row) use ($style, $length) {
80 80
             $text = $this->disabled ? $style->getDisabledItemText($row) : $row;
81 81
 
82 82
             if ($key === 0) {
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
      */
116 116
     public function getSelectAction() : ?callable
117 117
     {
118
-        return function (CliMenu $menu) {
118
+        return function(CliMenu $menu) {
119 119
             $this->showSubMenu($menu);
120 120
         };
121 121
     }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -76,7 +76,8 @@  discard block
 block discarded – undo
76 76
             )
77 77
         );
78 78
 
79
-        return mapWithKeys($rows, function (int $key, string $row) use ($style, $length) {
79
+        return mapWithKeys($rows, function (int $key, string $row) use ($style, $length)
80
+        {
80 81
             $text = $this->disabled ? $style->getDisabledItemText($row) : $row;
81 82
 
82 83
             if ($key === 0) {
@@ -115,7 +116,8 @@  discard block
 block discarded – undo
115 116
      */
116 117
     public function getSelectAction() : ?callable
117 118
     {
118
-        return function (CliMenu $menu) {
119
+        return function (CliMenu $menu)
120
+        {
119 121
             $this->showSubMenu($menu);
120 122
         };
121 123
     }
Please login to merge, or discard this patch.
etc/rc/vendor/php-school/cli-menu/src/MenuItem/RadioItem.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
             )
84 84
         );
85 85
 
86
-        return array_map(function ($row, $key) use ($style, $length, $itemExtra) {
86
+        return array_map(function($row, $key) use ($style, $length, $itemExtra) {
87 87
             $text = $this->disabled ? $style->getDisabledItemText($row) : $row;
88 88
 
89 89
             if ($key === 0) {
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
      */
118 118
     public function getSelectAction() : ?callable
119 119
     {
120
-        return function (CliMenu $cliMenu) {
120
+        return function(CliMenu $cliMenu) {
121 121
             $parentItem = $cliMenu->getItemByIndex($cliMenu->getSelectedItemIndex());
122 122
 
123 123
             $siblings = $parentItem instanceof SplitItem
@@ -126,14 +126,14 @@  discard block
 block discarded – undo
126 126
 
127 127
             $filtered = array_filter(
128 128
                 $siblings,
129
-                function (MenuItemInterface $item) {
129
+                function(MenuItemInterface $item) {
130 130
                     return $item instanceof self;
131 131
                 }
132 132
             );
133 133
 
134 134
             array_walk(
135 135
                 $filtered,
136
-                function (RadioItem $item) {
136
+                function(RadioItem $item) {
137 137
                     $item->setUnchecked();
138 138
                 }
139 139
             );
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -83,7 +83,8 @@  discard block
 block discarded – undo
83 83
             )
84 84
         );
85 85
 
86
-        return array_map(function ($row, $key) use ($style, $length, $itemExtra) {
86
+        return array_map(function ($row, $key) use ($style, $length, $itemExtra)
87
+        {
87 88
             $text = $this->disabled ? $style->getDisabledItemText($row) : $row;
88 89
 
89 90
             if ($key === 0) {
@@ -117,7 +118,8 @@  discard block
 block discarded – undo
117 118
      */
118 119
     public function getSelectAction() : ?callable
119 120
     {
120
-        return function (CliMenu $cliMenu) {
121
+        return function (CliMenu $cliMenu)
122
+        {
121 123
             $parentItem = $cliMenu->getItemByIndex($cliMenu->getSelectedItemIndex());
122 124
 
123 125
             $siblings = $parentItem instanceof SplitItem
@@ -126,14 +128,16 @@  discard block
 block discarded – undo
126 128
 
127 129
             $filtered = array_filter(
128 130
                 $siblings,
129
-                function (MenuItemInterface $item) {
131
+                function (MenuItemInterface $item)
132
+                {
130 133
                     return $item instanceof self;
131 134
                 }
132 135
             );
133 136
 
134 137
             array_walk(
135 138
                 $filtered,
136
-                function (RadioItem $item) {
139
+                function (RadioItem $item)
140
+                {
137 141
                     $item->setUnchecked();
138 142
                 }
139 143
             );
Please login to merge, or discard this patch.
etc/rc/vendor/php-school/cli-menu/src/MenuItem/CheckboxItem.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
             )
84 84
         );
85 85
 
86
-        return array_map(function ($row, $key) use ($style, $length, $itemExtra) {
86
+        return array_map(function($row, $key) use ($style, $length, $itemExtra) {
87 87
             $text = $this->disabled ? $style->getDisabledItemText($row) : $row;
88 88
 
89 89
             if ($key === 0) {
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
      */
118 118
     public function getSelectAction() : ?callable
119 119
     {
120
-        return function (CliMenu $cliMenu) {
120
+        return function(CliMenu $cliMenu) {
121 121
             $this->toggle();
122 122
             $cliMenu->redraw();
123 123
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -83,7 +83,8 @@  discard block
 block discarded – undo
83 83
             )
84 84
         );
85 85
 
86
-        return array_map(function ($row, $key) use ($style, $length, $itemExtra) {
86
+        return array_map(function ($row, $key) use ($style, $length, $itemExtra)
87
+        {
87 88
             $text = $this->disabled ? $style->getDisabledItemText($row) : $row;
88 89
 
89 90
             if ($key === 0) {
@@ -117,7 +118,8 @@  discard block
 block discarded – undo
117 118
      */
118 119
     public function getSelectAction() : ?callable
119 120
     {
120
-        return function (CliMenu $cliMenu) {
121
+        return function (CliMenu $cliMenu)
122
+        {
121 123
             $this->toggle();
122 124
             $cliMenu->redraw();
123 125
 
Please login to merge, or discard this patch.