Completed
Pull Request — master (#82)
by
unknown
01:48
created
src/CliMenu.php 2 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -168,9 +168,9 @@  discard block
 block discarded – undo
168 168
                     $previousItem = $this->getSelectedItem();
169 169
                     $this->moveSelection($input);
170 170
                     $newItem = $this->getSelectedItem();
171
-					if ($previousItem !== $newItem) {
172
-						$this->draw($previousItem, $newItem);
173
-					}
171
+                    if ($previousItem !== $newItem) {
172
+                        $this->draw($previousItem, $newItem);
173
+                    }
174 174
                     break;
175 175
                 case 'enter':
176 176
                     $this->executeCurrentItem();
@@ -253,30 +253,30 @@  discard block
 block discarded – undo
253 253
 
254 254
         $frame->addRows($this->drawMenuItem(new LineBreakItem()));
255 255
 
256
-		$frame->newLine(2);
256
+        $frame->newLine(2);
257 257
 
258
-		if ($previousItem && $newItem) {
258
+        if ($previousItem && $newItem) {
259 259
 
260
-			$rows = $frame->getRows();
260
+            $rows = $frame->getRows();
261 261
 
262
-			$this->terminal->moveCursorToTop();
263
-			$this->terminal->moveCursorDown($previousItem->getStartRowNumber());
264
-			echo rtrim($rows[$previousItem->getStartRowNumber()], "\n\r");
262
+            $this->terminal->moveCursorToTop();
263
+            $this->terminal->moveCursorDown($previousItem->getStartRowNumber());
264
+            echo rtrim($rows[$previousItem->getStartRowNumber()], "\n\r");
265 265
 
266
-			$this->terminal->moveCursorToTop();
267
-			$this->terminal->moveCursorDown($newItem->getStartRowNumber());
268
-			echo rtrim($rows[$newItem->getStartRowNumber()], "\n\r");
266
+            $this->terminal->moveCursorToTop();
267
+            $this->terminal->moveCursorDown($newItem->getStartRowNumber());
268
+            echo rtrim($rows[$newItem->getStartRowNumber()], "\n\r");
269 269
 
270
-		} else {
270
+        } else {
271 271
 
272
-	        $this->terminal->clean();
273
-    	    $this->terminal->moveCursorToTop();
272
+            $this->terminal->clean();
273
+            $this->terminal->moveCursorToTop();
274 274
 
275
-	        foreach ($frame->getRows() as $row) {
276
-    	        echo $row;
277
-			}
275
+            foreach ($frame->getRows() as $row) {
276
+                echo $row;
277
+            }
278 278
 
279
-		}
279
+        }
280 280
 
281 281
         $this->currentFrame = $frame;
282 282
     }
@@ -309,9 +309,9 @@  discard block
 block discarded – undo
309 309
             );
310 310
         }, $rows);
311 311
 
312
-		$item->setNumberOfRows( count( $rows ) );
312
+        $item->setNumberOfRows( count( $rows ) );
313 313
 
314
-		return array( $rows, $item );
314
+        return array( $rows, $item );
315 315
     }
316 316
 
317 317
     /**
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
                 : $this->selectedItem++;
193 193
 
194 194
             if (!array_key_exists($this->selectedItem, $this->items)) {
195
-                $this->selectedItem  = $direction === 'up'
195
+                $this->selectedItem = $direction === 'up'
196 196
                     ? end($itemKeys)
197 197
                     : reset($itemKeys);
198 198
             } elseif ($this->getSelectedItem()->canSelect()) {
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
             $frame->addRows($this->drawMenuItem(new LineBreakItem($this->style->getTitleSeparator())));
248 248
         }
249 249
 
250
-        array_map(function ($item, $index) use ($frame) {
250
+        array_map(function($item, $index) use ($frame) {
251 251
             $frame->addRows($this->drawMenuItem($item, $index === $this->selectedItem));
252 252
         }, $this->items, array_keys($this->items));
253 253
 
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
             ? $this->style->getSelectedUnsetCode()
297 297
             : $this->style->getUnselectedUnsetCode();
298 298
 
299
-        $rows = array_map(function ($row) use ($setColour, $unsetColour) {
299
+        $rows = array_map(function($row) use ($setColour, $unsetColour) {
300 300
             return sprintf(
301 301
                 "%s%s%s%s%s%s%s\n\r",
302 302
                 str_repeat(' ', $this->style->getMargin()),
@@ -309,9 +309,9 @@  discard block
 block discarded – undo
309 309
             );
310 310
         }, $rows);
311 311
 
312
-		$item->setNumberOfRows( count( $rows ) );
312
+		$item->setNumberOfRows(count($rows));
313 313
 
314
-		return array( $rows, $item );
314
+		return array($rows, $item);
315 315
     }
316 316
 
317 317
     /**
Please login to merge, or discard this patch.
src/Frame.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,9 +23,9 @@
 block discarded – undo
23 23
     }
24 24
 
25 25
     public function addRows(array $params = []) : void
26
-	{
27
-		list($rows, $item) = $params;
28
-		$item->setStartRowNumber(count($this->rows));
26
+    {
27
+        list($rows, $item) = $params;
28
+        $item->setStartRowNumber(count($this->rows));
29 29
         foreach ($rows as $row) {
30 30
             $this->rows[] = $row;
31 31
         }
Please login to merge, or discard this patch.
src/MenuItem/StaticItem.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -16,52 +16,52 @@
 block discarded – undo
16 16
      */
17 17
     private $text;
18 18
 
19
-	/**
20
-	 * @var int
21
-	 */
22
-	private $numberOfRows = 0;
19
+    /**
20
+     * @var int
21
+     */
22
+    private $numberOfRows = 0;
23 23
 
24
-	/**
25
-	 * @var int
26
-	 */
27
-	private $startRowNumber = 0;
24
+    /**
25
+     * @var int
26
+     */
27
+    private $startRowNumber = 0;
28 28
 
29 29
     public function __construct(string $text)
30 30
     {
31 31
         $this->text = $text;
32 32
     }
33 33
 
34
-	/**
35
-	 * Returns the number of terminal rows the item takes
36
-	 */
37
-	public function getNumberOfRows() {
38
-		return $this->numberOfRows;
39
-	}
40
-
41
-	/**
42
-	 * Sets the row number the item starts at in the frame
43
-	 */
44
-	public function setStartRowNumber(int $rowNumber) {
45
-		$this->startRowNumber = $rowNumber;
46
-	}
47
-
48
-	/**
49
-	 * Returns the row number the item starts at in the frame
50
-	 */
51
-	public function getStartRowNumber() {
52
-		return $this->startRowNumber;
53
-	}
34
+    /**
35
+     * Returns the number of terminal rows the item takes
36
+     */
37
+    public function getNumberOfRows() {
38
+        return $this->numberOfRows;
39
+    }
40
+
41
+    /**
42
+     * Sets the row number the item starts at in the frame
43
+     */
44
+    public function setStartRowNumber(int $rowNumber) {
45
+        $this->startRowNumber = $rowNumber;
46
+    }
47
+
48
+    /**
49
+     * Returns the row number the item starts at in the frame
50
+     */
51
+    public function getStartRowNumber() {
52
+        return $this->startRowNumber;
53
+    }
54 54
 
55 55
     /**
56 56
      * The output text for the item
57 57
      */
58 58
     public function getRows(MenuStyle $style, bool $selected = false) : array
59 59
     {
60
-		$rows = explode("\n", StringUtil::wordwrap($this->text, $style->getContentWidth()));
60
+        $rows = explode("\n", StringUtil::wordwrap($this->text, $style->getContentWidth()));
61 61
 
62
-		$this->numberOfRows = count($rows);
62
+        $this->numberOfRows = count($rows);
63 63
 
64
-		return $rows;
64
+        return $rows;
65 65
     }
66 66
 
67 67
     /**
Please login to merge, or discard this patch.
src/MenuItem/SelectableTrait.php 2 patches
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -23,38 +23,38 @@  discard block
 block discarded – undo
23 23
     /**
24 24
      * @var bool
25 25
      */
26
-	private $disabled = false;
27
-
28
-	/**
29
-	 * @var int
30
-	 */
31
-	private $numberOfRows = 0;
32
-
33
-	/**
34
-	 * @var int
35
-	 */
36
-	private $startRowNumber = 0;
37
-
38
-	/**
39
-	 * Returns the number of terminal rows the item takes
40
-	 */
41
-	public function getNumberOfRows() {
42
-		return $this->numberOfRows;
43
-	}
44
-
45
-	/**
46
-	 * Sets the row number the item starts at in the frame
47
-	 */
48
-	public function setStartRowNumber(int $rowNumber) {
49
-		$this->startRowNumber = $rowNumber;
50
-	}
51
-
52
-	/**
53
-	 * Returns the row number the item starts at in the frame
54
-	 */
55
-	public function getStartRowNumber() {
56
-		return $this->startRowNumber;
57
-	}
26
+    private $disabled = false;
27
+
28
+    /**
29
+     * @var int
30
+     */
31
+    private $numberOfRows = 0;
32
+
33
+    /**
34
+     * @var int
35
+     */
36
+    private $startRowNumber = 0;
37
+
38
+    /**
39
+     * Returns the number of terminal rows the item takes
40
+     */
41
+    public function getNumberOfRows() {
42
+        return $this->numberOfRows;
43
+    }
44
+
45
+    /**
46
+     * Sets the row number the item starts at in the frame
47
+     */
48
+    public function setStartRowNumber(int $rowNumber) {
49
+        $this->startRowNumber = $rowNumber;
50
+    }
51
+
52
+    /**
53
+     * Returns the row number the item starts at in the frame
54
+     */
55
+    public function getStartRowNumber() {
56
+        return $this->startRowNumber;
57
+    }
58 58
 
59 59
     /**
60 60
      * The output text for the item
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
                 $length,
75 75
                 sprintf("\n%s", str_repeat(' ', mb_strlen($marker)))
76 76
             )
77
-		);
77
+        );
78 78
 
79
-		$this->numberOfRows = count($rows);
79
+        $this->numberOfRows = count($rows);
80 80
 
81 81
         return array_map(function ($row, $key) use ($style, $length) {
82 82
             $text = $this->disabled ? $style->getDisabledItemText($row) : $row;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@
 block discarded – undo
78 78
 
79 79
 		$this->numberOfRows = count($rows);
80 80
 
81
-        return array_map(function ($row, $key) use ($style, $length) {
81
+        return array_map(function($row, $key) use ($style, $length) {
82 82
             $text = $this->disabled ? $style->getDisabledItemText($row) : $row;
83 83
 
84 84
             if ($key === 0) {
Please login to merge, or discard this patch.
src/MenuItem/MenuItemInterface.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -9,20 +9,20 @@
 block discarded – undo
9 9
  */
10 10
 interface MenuItemInterface
11 11
 {
12
-	/**
13
-	 * Returns the number of terminal rows the item takes
14
-	 */
15
-	public function getNumberOfRows() : int;
16
-
17
-	/**
18
-	 * Sets the row number the item starts at in the frame
19
-	 */
20
-	public function setStartRowNumber(int $rowNumber) : void;
21
-
22
-	/**
23
-	 * Returns the row number the item starts at in the frame
24
-	 */
25
-	public function getStartRowNumber() : int;
12
+    /**
13
+     * Returns the number of terminal rows the item takes
14
+     */
15
+    public function getNumberOfRows() : int;
16
+
17
+    /**
18
+     * Sets the row number the item starts at in the frame
19
+     */
20
+    public function setStartRowNumber(int $rowNumber) : void;
21
+
22
+    /**
23
+     * Returns the row number the item starts at in the frame
24
+     */
25
+    public function getStartRowNumber() : int;
26 26
 
27 27
     /**
28 28
      * The output text for the item
Please login to merge, or discard this patch.
src/MenuItem/LineBreakItem.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -20,15 +20,15 @@  discard block
 block discarded – undo
20 20
      */
21 21
     private $lines;
22 22
 
23
-	/**
24
-	 * @var int
25
-	 */
26
-	private $numberOfRows = 0;
23
+    /**
24
+     * @var int
25
+     */
26
+    private $numberOfRows = 0;
27 27
 
28
-	/**
29
-	 * @var int
30
-	 */
31
-	private $startRowNumber = 0;
28
+    /**
29
+     * @var int
30
+     */
31
+    private $startRowNumber = 0;
32 32
 
33 33
     public function __construct(string $breakChar = ' ', int $lines = 1)
34 34
     {
@@ -36,26 +36,26 @@  discard block
 block discarded – undo
36 36
         $this->lines     = $lines;
37 37
     }
38 38
 
39
-	/**
40
-	 * Returns the number of terminal rows the item takes
41
-	 */
42
-	public function getNumberOfRows() {
43
-		return $this->numberOfRows;
44
-	}
45
-
46
-	/**
47
-	 * Sets the row number the item starts at in the frame
48
-	 */
49
-	public function setStartRowNumber(int $rowNumber) {
50
-		$this->startRowNumber = $rowNumber;
51
-	}
52
-
53
-	/**
54
-	 * Returns the row number the item starts at in the frame
55
-	 */
56
-	public function getStartRowNumber() {
57
-		return $this->startRowNumber;
58
-	}
39
+    /**
40
+     * Returns the number of terminal rows the item takes
41
+     */
42
+    public function getNumberOfRows() {
43
+        return $this->numberOfRows;
44
+    }
45
+
46
+    /**
47
+     * Sets the row number the item starts at in the frame
48
+     */
49
+    public function setStartRowNumber(int $rowNumber) {
50
+        $this->startRowNumber = $rowNumber;
51
+    }
52
+
53
+    /**
54
+     * Returns the row number the item starts at in the frame
55
+     */
56
+    public function getStartRowNumber() {
57
+        return $this->startRowNumber;
58
+    }
59 59
 
60 60
     /**
61 61
      * The output text for the item
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
             ), $this->lines))
71 71
         );
72 72
 
73
-		$this->numberOfRows = count($rows);
73
+        $this->numberOfRows = count($rows);
74 74
 
75
-		return $rows;
75
+        return $rows;
76 76
     }
77 77
 
78 78
     /**
Please login to merge, or discard this patch.
src/MenuItem/AsciiArtItem.php 2 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -32,15 +32,15 @@  discard block
 block discarded – undo
32 32
      */
33 33
     private $artLength;
34 34
 
35
-	/**
36
-	 * @var int
37
-	 */
38
-	private $numberOfRows = 0;
35
+    /**
36
+     * @var int
37
+     */
38
+    private $numberOfRows = 0;
39 39
 
40
-	/**
41
-	 * @var int
42
-	 */
43
-	private $startRowNumber = 0;
40
+    /**
41
+     * @var int
42
+     */
43
+    private $startRowNumber = 0;
44 44
 
45 45
     public function __construct(string $text, string $position = self::POSITION_CENTER)
46 46
     {
@@ -51,26 +51,26 @@  discard block
 block discarded – undo
51 51
         $this->artLength = max(array_map('mb_strlen', explode("\n", $text)));
52 52
     }
53 53
 
54
-	/**
55
-	 * Returns the number of terminal rows the item takes
56
-	 */
57
-	public function getNumberOfRows() {
58
-		return $this->numberOfRows;
59
-	}
54
+    /**
55
+     * Returns the number of terminal rows the item takes
56
+     */
57
+    public function getNumberOfRows() {
58
+        return $this->numberOfRows;
59
+    }
60 60
 
61
-	/**
62
-	 * Sets the row number the item starts at in the frame
63
-	 */
64
-	public function setStartRowNumber(int $rowNumber) {
65
-		$this->startRowNumber = $rowNumber;
66
-	}
61
+    /**
62
+     * Sets the row number the item starts at in the frame
63
+     */
64
+    public function setStartRowNumber(int $rowNumber) {
65
+        $this->startRowNumber = $rowNumber;
66
+    }
67 67
 
68
-	/**
69
-	 * Returns the row number the item starts at in the frame
70
-	 */
71
-	public function getStartRowNumber() {
72
-		return $this->startRowNumber;
73
-	}
68
+    /**
69
+     * Returns the row number the item starts at in the frame
70
+     */
71
+    public function getStartRowNumber() {
72
+        return $this->startRowNumber;
73
+    }
74 74
 
75 75
     /**
76 76
      * The output text for the item
@@ -102,11 +102,11 @@  discard block
 block discarded – undo
102 102
             }
103 103
 
104 104
             return $row;
105
-		}, explode("\n", $this->text));
105
+        }, explode("\n", $this->text));
106 106
 
107
-		$this->numberOfRows = count($rows);
107
+        $this->numberOfRows = count($rows);
108 108
 
109
-		return $rows;
109
+        return $rows;
110 110
     }
111 111
 
112 112
     /**
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@
 block discarded – undo
77 77
      */
78 78
     public function getRows(MenuStyle $style, bool $selected = false) : array
79 79
     {
80
-        $rows = array_map(function ($row) use ($style) {
80
+        $rows = array_map(function($row) use ($style) {
81 81
             $length = mb_strlen($row);
82 82
 
83 83
             $padding = $style->getContentWidth() - $length;
Please login to merge, or discard this patch.