Conditions | 6 |
Paths | 17 |
Total Lines | 39 |
Code Lines | 24 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 42 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
90 | protected function displayAnimation() |
||
91 | { |
||
92 | $counter = 0; |
||
93 | $forward = true; |
||
94 | $before = 0; |
||
95 | $after = $steps - \strlen($cursor); |
||
96 | |||
97 | while (true) { |
||
98 | echo '['; |
||
99 | |||
100 | for ($i = 1; $i <= $before; $i++) { |
||
101 | echo ' '; |
||
102 | } |
||
103 | |||
104 | echo $cursor; |
||
105 | |||
106 | for ($i = 0; $i <= $after; $i++) { |
||
107 | echo ' '; |
||
108 | } |
||
109 | |||
110 | echo ']'; |
||
111 | echo "\r"; |
||
112 | |||
113 | $counter++; |
||
114 | |||
115 | if ($forward) { |
||
116 | $before++; |
||
117 | $after--; |
||
118 | } else { |
||
119 | $before--; |
||
120 | $after++; |
||
121 | } |
||
122 | |||
123 | if ($counter === ($steps - (\strlen($cursor) -1))) { |
||
124 | $counter = 0; |
||
125 | $forward = !$forward; |
||
126 | } |
||
127 | |||
128 | sleep(1); |
||
129 | } |
||
137 |