Added width to StyleInterface

This commit is contained in:
Chris 2024-03-07 01:06:40 +01:00
parent 51f7259fe9
commit 8a0c9ccffc
9 changed files with 51 additions and 3 deletions

View File

@ -15,4 +15,9 @@ class BrailleBounceStyle implements StyleInterface
mb_chr(0x2812), mb_chr(0x2812),
]; ];
} }
public function getWidth(): int
{
return 1;
}
} }

View File

@ -15,4 +15,9 @@ class BrailleDotsStyle implements StyleInterface
mb_chr(0x281b), mb_chr(0x281b),
]; ];
} }
public function getWidth(): int
{
return 1;
}
} }

View File

@ -17,6 +17,11 @@ class BrailleTallDotsStyle implements StyleInterface
mb_chr(0x281b), mb_chr(0x281b),
]; ];
} }
public function getWidth(): int
{
return 1;
}
} }
/* /*
@ -39,4 +44,4 @@ class BrailleTallDotsStyle implements StyleInterface
28Fx | 28Fx |
*/ */

View File

@ -21,6 +21,11 @@ class BrailleWideDotsStyle implements StyleInterface
"⠈⠙", "⠈⠙",
]; ];
} }
public function getWidth(): int
{
return 2;
}
} }
/* /*
@ -43,4 +48,4 @@ class BrailleWideDotsStyle implements StyleInterface
28Fx | 28Fx |
*/ */

View File

@ -21,6 +21,11 @@ class BrailleWideSpinnerStyle implements StyleInterface
"", "",
]; ];
} }
public function getWidth(): int
{
return 2;
}
} }
/* /*
@ -43,4 +48,4 @@ class BrailleWideSpinnerStyle implements StyleInterface
28Fx | 28Fx |
*/ */

View File

@ -13,4 +13,9 @@ class RollingBallStyle implements StyleInterface
mb_chr(0x25d2), mb_chr(0x25d2),
]; ];
} }
public function getWidth(): int
{
return 1;
}
} }

View File

@ -13,4 +13,9 @@ class SpinnerStyle implements StyleInterface
mb_chr(0x25df).' ', mb_chr(0x25df).' ',
]; ];
} }
public function getWidth(): int
{
return 2;
}
} }

View File

@ -13,4 +13,9 @@ class SpinningBarStyle implements StyleInterface
"|", "|",
]; ];
} }
public function getWidth(): int
{
return 1;
}
} }

View File

@ -4,5 +4,13 @@ namespace NoccyLabs\Spinner\Style;
interface StyleInterface interface StyleInterface
{ {
/**
* Returns an array of frames used to render the spinner
*/
public function getFrames(): array; public function getFrames(): array;
/**
* Get the width of this spinner in characters
*/
public function getWidth(): int;
} }