Completed
Push — master ( a82150...06534f )
by Aydin
11s
created
src/Dialogue/Dialogue.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -69,12 +69,12 @@
 block discarded – undo
69 69
     {
70 70
         //y
71 71
         $textLines          = count(explode("\n", $this->text)) + 2;
72
-        $this->y            = ceil($this->parentMenu->getCurrentFrame()->count() / 2) - ceil($textLines / 2) + 1;
72
+        $this->y            = ceil($this->parentMenu->getCurrentFrame()->count()/2) - ceil($textLines/2) + 1;
73 73
 
74 74
         //x
75 75
         $parentStyle        = $this->parentMenu->getStyle();
76
-        $dialogueHalfLength = (mb_strlen($this->text) + ($this->style->getPadding() * 2)) / 2;
77
-        $widthHalfLength    = ceil($parentStyle->getWidth() / 2 + $parentStyle->getMargin());
76
+        $dialogueHalfLength = (mb_strlen($this->text) + ($this->style->getPadding()*2))/2;
77
+        $widthHalfLength    = ceil($parentStyle->getWidth()/2 + $parentStyle->getMargin());
78 78
         $this->x            = $widthHalfLength - $dialogueHalfLength;
79 79
     }
80 80
 
Please login to merge, or discard this patch.
src/Input/InputIO.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     {
99 99
         return max(
100 100
             array_map(
101
-                function (string $line) {
101
+                function(string $line) {
102 102
                     return mb_strlen($line);
103 103
                 },
104 104
                 $lines
@@ -110,14 +110,14 @@  discard block
 block discarded – undo
110 110
     {
111 111
         $lines = 5; //1. empty 2. prompt text 3. empty 4. input 5. empty
112 112
 
113
-        return ceil($this->parentMenu->getCurrentFrame()->count() / 2) - ceil($lines /2) + 1;
113
+        return ceil($this->parentMenu->getCurrentFrame()->count()/2) - ceil($lines/2) + 1;
114 114
     }
115 115
 
116 116
     private function calculateYPositionWithError() : int
117 117
     {
118 118
         $lines = 7; //1. empty 2. prompt text 3. empty 4. input 5. empty 6. error 7. empty
119 119
 
120
-        return ceil($this->parentMenu->getCurrentFrame()->count() / 2) - ceil($lines /2) + 1;
120
+        return ceil($this->parentMenu->getCurrentFrame()->count()/2) - ceil($lines/2) + 1;
121 121
     }
122 122
 
123 123
     private function calculateXPosition(Input $input, string $userInput) : int
@@ -131,8 +131,8 @@  discard block
 block discarded – undo
131 131
         );
132 132
 
133 133
         $parentStyle     = $this->parentMenu->getStyle();
134
-        $halfWidth       = ($width + ($input->getStyle()->getPadding() * 2)) / 2;
135
-        $parentHalfWidth = ceil($parentStyle->getWidth() / 2 + $parentStyle->getMargin());
134
+        $halfWidth       = ($width + ($input->getStyle()->getPadding()*2))/2;
135
+        $parentHalfWidth = ceil($parentStyle->getWidth()/2 + $parentStyle->getMargin());
136 136
 
137 137
         return $parentHalfWidth - $halfWidth;
138 138
     }
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
         );
165 165
 
166 166
         $textLength = mb_strlen(StringUtil::stripAnsiEscapeSequence($text));
167
-        $leftFill   = ($width / 2) - ($textLength / 2);
167
+        $leftFill   = ($width/2) - ($textLength/2);
168 168
         $rightFill  = ceil($width - $leftFill - $textLength);
169 169
 
170 170
         $this->drawLine(
Please login to merge, or discard this patch.
examples/basic-centered.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,16 +3,16 @@
 block discarded – undo
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
     echo $menu->getSelectedItem()->getText();
10 10
 };
11 11
 
12 12
 $menu = (new CliMenuBuilder)
13 13
     ->setTitle('Basic CLI Menu')
14 14
     ->addItem('First Item', $itemCallable)
15
-    ->addItem('Make menu wider', function (CliMenu $menu) {
15
+    ->addItem('Make menu wider', function(CliMenu $menu) {
16 16
         $menu->getStyle()->setWidth($menu->getStyle()->getWidth() + 10);
17 17
         $menu->redraw();
18 18
     })
Please login to merge, or discard this patch.
src/MenuStyle.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
      */
240 240
     protected function calculateContentWidth() : void
241 241
     {
242
-        $this->contentWidth = $this->width - ($this->padding * 2);
242
+        $this->contentWidth = $this->width - ($this->padding*2);
243 243
     }
244 244
 
245 245
     public function getFg() : string
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
     public function setMarginAuto() : self
309 309
     {
310 310
         $this->marginAuto = true;
311
-        $this->margin = floor(($this->terminal->getWidth() - $this->width) / 2);
311
+        $this->margin = floor(($this->terminal->getWidth() - $this->width)/2);
312 312
         
313 313
         return $this;
314 314
     }
Please login to merge, or discard this patch.