Completed
Push — master ( c7bdb1...5472d7 )
by Aydin
04:34
created
src/CliMenu.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,6 @@
 block discarded – undo
2 2
 
3 3
 namespace PhpSchool\CliMenu;
4 4
 
5
-use PhpSchool\CliMenu\Exception\InvalidInstantiationException;
6 5
 use PhpSchool\CliMenu\Exception\InvalidTerminalException;
7 6
 use PhpSchool\CliMenu\Exception\MenuNotOpenException;
8 7
 use PhpSchool\CliMenu\MenuItem\LineBreakItem;
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
                 : $this->selectedItem++;
216 216
 
217 217
             if (!array_key_exists($this->selectedItem, $this->items)) {
218
-                $this->selectedItem  = $direction === 'up'
218
+                $this->selectedItem = $direction === 'up'
219 219
                     ? end($itemKeys)
220 220
                     : reset($itemKeys);
221 221
             } elseif ($this->getSelectedItem()->canSelect()) {
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
             $frame->addRows($this->drawMenuItem(new LineBreakItem($this->style->getTitleSeparator())));
276 276
         }
277 277
 
278
-        array_map(function ($item, $index) use ($frame) {
278
+        array_map(function($item, $index) use ($frame) {
279 279
             $frame->addRows($this->drawMenuItem($item, $index === $this->selectedItem));
280 280
         }, $this->items, array_keys($this->items));
281 281
 
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
             ? $this->style->getSelectedUnsetCode()
310 310
             : $this->style->getUnselectedUnsetCode();
311 311
 
312
-        return array_map(function ($row) use ($setColour, $unsetColour) {
312
+        return array_map(function($row) use ($setColour, $unsetColour) {
313 313
             return sprintf(
314 314
                 "%s%s%s%s%s%s%s\n\r",
315 315
                 str_repeat(' ', $this->style->getMargin()),
Please login to merge, or discard this patch.
src/CliMenuBuilder.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
     }
376 376
 
377 377
     /**
378
-     * @return array
378
+     * @return SelectableItem[]
379 379
      */
380 380
     private function getDefaultItems()
381 381
     {
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 
464 464
     /**
465 465
      * @param string $id
466
-     * @return CliMenu
466
+     * @return CliMenuBuilder
467 467
      * @throws RuntimeException
468 468
      */
469 469
     public function getSubMenu($id)
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
      */
405 405
     private function itemsHaveExtra(array $items)
406 406
     {
407
-        return !empty(array_filter($items, function (MenuItemInterface $item) {
407
+        return !empty(array_filter($items, function(MenuItemInterface $item) {
408 408
             return $item->showsItemExtra();
409 409
         }));
410 410
     }
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
      */
482 482
     private function buildSubMenus(array $items)
483 483
     {
484
-        return array_map(function ($item) {
484
+        return array_map(function($item) {
485 485
             if (!is_string($item)) {
486 486
                 return $item;
487 487
             }
Please login to merge, or discard this patch.
src/MenuStyle.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -376,8 +376,8 @@
 block discarded – undo
376 376
     /**
377 377
      * Get padding for right had side of content
378 378
      *
379
-     * @param $contentLength
380
-     * @return int
379
+     * @param integer $contentLength
380
+     * @return double
381 381
      */
382 382
     public function getRightHandPadding($contentLength)
383 383
     {
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,6 @@
 block discarded – undo
2 2
 
3 3
 namespace PhpSchool\CliMenu;
4 4
 
5
-use PhpSchool\CliMenu\Exception\InvalidInstantiationException;
6 5
 use PhpSchool\CliMenu\Terminal\TerminalFactory;
7 6
 use PhpSchool\CliMenu\Terminal\TerminalInterface;
8 7
 
Please login to merge, or discard this patch.
examples/confirm.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,9 +4,9 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
examples/toggle-item-extra.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -4,13 +4,13 @@
 block discarded – undo
4 4
 use PhpSchool\CliMenu\CliMenuBuilder;
5 5
 use PhpSchool\CliMenu\MenuItem\MenuItemInterface;
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
     static $i = 1;
11 11
 
12 12
     foreach ($menu->getItems() as $item) {
13
-        $i % 2 === 0
13
+        $i%2 === 0
14 14
             ? $item->showItemExtra()
15 15
             : $item->hideItemExtra();
16 16
 
Please login to merge, or discard this patch.
examples/flash.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,9 +4,9 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
examples/crazy-redraw.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -5,13 +5,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     );
Please login to merge, or discard this patch.
examples/redraw.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,9 +4,9 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Dialogue/Dialogue.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -75,12 +75,12 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.