Skip to content

Commit 4901d98

Browse files
committed
~
1 parent c8cc5a5 commit 4901d98

File tree

5 files changed

+17
-24
lines changed

5 files changed

+17
-24
lines changed

.tools/.report/.build/coverage.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
Code Coverage Report Summary:
44
Classes: 100.00% (207/207)
5-
Methods: 100.00% (736/736)
6-
Lines: 100.00% (3717/3717)
5+
Methods: 100.00% (737/737)
6+
Lines: 100.00% (3718/3718)
77

example/async/settings/custom-char-palette.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,7 @@ protected function createFrame(string $element): ICharFrame
3030

3131
protected function sequence(): Traversable
3232
{
33-
$a = [' ', '. ', '.. ', '...', ' ..', ' .', ' ']; // note the width of each element
34-
35-
if ($this->options->getReversed()) {
36-
$a = array_reverse($a);
37-
}
38-
39-
yield from $a;
33+
yield from [' ', '. ', '.. ', '...', ' ..', ' .', ' ']; // note the width of each element
4034
}
4135
};
4236

example/async/settings/replace-spinner.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,7 @@ protected function createFrame(string $element): ICharFrame
2525

2626
protected function sequence(): Traversable
2727
{
28-
$a = [' ', '. ', '.. ', '...', ' ..', ' .', ' ']; // note the width of each element
29-
30-
if ($this->options->getReversed()) {
31-
$a = array_reverse($a);
32-
}
33-
34-
yield from $a;
28+
yield from [' ', '. ', '.. ', '...', ' ..', ' .', ' ']; // note the width of each element
3529
}
3630
};
3731

src/Spinner/Core/Palette/A/ACharPalette.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,22 @@ abstract class ACharPalette extends APalette implements ICharPalette
1919
protected function getEntries(?IPaletteMode $mode = null): Traversable
2020
{
2121
/** @var string $element */
22-
foreach ($this->sequence() as $element) {
22+
foreach ($this->getSequence() as $element) {
2323
yield $this->createFrame($element);
2424
}
2525
}
2626

27+
protected function getSequence(): Traversable
28+
{
29+
$sequence = $this->sequence();
30+
31+
if ($this->options->getReversed()) {
32+
$sequence = array_reverse(iterator_to_array($sequence));
33+
}
34+
35+
yield from $sequence;
36+
}
37+
2738
/**
2839
* @return Traversable<string>
2940
*/

src/Spinner/Core/Palette/Snake.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,7 @@ final class Snake extends ACharPalette
1515
{
1616
protected function sequence(): Traversable
1717
{
18-
$a = ['', '', '', '', '', '', '', ''];
19-
20-
if ($this->options->getReversed()) {
21-
$a = array_reverse($a);
22-
}
23-
24-
yield from $a;
18+
yield from ['', '', '', '', '', '', '', ''];
2519
}
2620

2721
protected function createFrame(string $element): ICharFrame

0 commit comments

Comments
 (0)