From 8a0c9ccffcc9842bb86e87746c0673830e24e201 Mon Sep 17 00:00:00 2001 From: Christopher Vagnetoft Date: Thu, 7 Mar 2024 01:06:40 +0100 Subject: [PATCH] Added width to StyleInterface --- src/Style/BrailleBounceStyle.php | 5 +++++ src/Style/BrailleDotsStyle.php | 5 +++++ src/Style/BrailleTallDotsStyle.php | 7 ++++++- src/Style/BrailleWideDotsStyle.php | 7 ++++++- src/Style/BrailleWideSpinnerStyle.php | 7 ++++++- src/Style/RollingBallStyle.php | 5 +++++ src/Style/SpinnerStyle.php | 5 +++++ src/Style/SpinningBarStyle.php | 5 +++++ src/Style/StyleInterface.php | 8 ++++++++ 9 files changed, 51 insertions(+), 3 deletions(-) diff --git a/src/Style/BrailleBounceStyle.php b/src/Style/BrailleBounceStyle.php index 990cac5..039a4cd 100644 --- a/src/Style/BrailleBounceStyle.php +++ b/src/Style/BrailleBounceStyle.php @@ -15,4 +15,9 @@ class BrailleBounceStyle implements StyleInterface mb_chr(0x2812), ]; } + + public function getWidth(): int + { + return 1; + } } diff --git a/src/Style/BrailleDotsStyle.php b/src/Style/BrailleDotsStyle.php index 80204ba..8de926f 100644 --- a/src/Style/BrailleDotsStyle.php +++ b/src/Style/BrailleDotsStyle.php @@ -15,4 +15,9 @@ class BrailleDotsStyle implements StyleInterface mb_chr(0x281b), ]; } + + public function getWidth(): int + { + return 1; + } } diff --git a/src/Style/BrailleTallDotsStyle.php b/src/Style/BrailleTallDotsStyle.php index 79a9fd3..20ad2fc 100644 --- a/src/Style/BrailleTallDotsStyle.php +++ b/src/Style/BrailleTallDotsStyle.php @@ -17,6 +17,11 @@ class BrailleTallDotsStyle implements StyleInterface mb_chr(0x281b), ]; } + + public function getWidth(): int + { + return 1; + } } /* @@ -39,4 +44,4 @@ class BrailleTallDotsStyle implements StyleInterface 28Fx | ⣰ ⣱ ⣲ ⣳ ⣴ ⣵ ⣶ ⣷ ⣸ ⣹ ⣺ ⣻ ⣼ ⣽ ⣾ ⣿ -*/ \ No newline at end of file +*/ diff --git a/src/Style/BrailleWideDotsStyle.php b/src/Style/BrailleWideDotsStyle.php index fcf266a..ae05a62 100644 --- a/src/Style/BrailleWideDotsStyle.php +++ b/src/Style/BrailleWideDotsStyle.php @@ -21,6 +21,11 @@ class BrailleWideDotsStyle implements StyleInterface "⠈⠙", ]; } + + public function getWidth(): int + { + return 2; + } } /* @@ -43,4 +48,4 @@ class BrailleWideDotsStyle implements StyleInterface 28Fx | ⣰ ⣱ ⣲ ⣳ ⣴ ⣵ ⣶ ⣷ ⣸ ⣹ ⣺ ⣻ ⣼ ⣽ ⣾ ⣿ -*/ \ No newline at end of file +*/ diff --git a/src/Style/BrailleWideSpinnerStyle.php b/src/Style/BrailleWideSpinnerStyle.php index 874d34c..eeb721a 100644 --- a/src/Style/BrailleWideSpinnerStyle.php +++ b/src/Style/BrailleWideSpinnerStyle.php @@ -21,6 +21,11 @@ class BrailleWideSpinnerStyle implements StyleInterface " ⠊", ]; } + + public function getWidth(): int + { + return 2; + } } /* @@ -43,4 +48,4 @@ class BrailleWideSpinnerStyle implements StyleInterface 28Fx | ⣰ ⣱ ⣲ ⣳ ⣴ ⣵ ⣶ ⣷ ⣸ ⣹ ⣺ ⣻ ⣼ ⣽ ⣾ ⣿ -*/ \ No newline at end of file +*/ diff --git a/src/Style/RollingBallStyle.php b/src/Style/RollingBallStyle.php index 9abc637..c381218 100644 --- a/src/Style/RollingBallStyle.php +++ b/src/Style/RollingBallStyle.php @@ -13,4 +13,9 @@ class RollingBallStyle implements StyleInterface mb_chr(0x25d2), ]; } + + public function getWidth(): int + { + return 1; + } } diff --git a/src/Style/SpinnerStyle.php b/src/Style/SpinnerStyle.php index 6ca65d6..bfb29fd 100644 --- a/src/Style/SpinnerStyle.php +++ b/src/Style/SpinnerStyle.php @@ -13,4 +13,9 @@ class SpinnerStyle implements StyleInterface mb_chr(0x25df).' ', ]; } + + public function getWidth(): int + { + return 2; + } } diff --git a/src/Style/SpinningBarStyle.php b/src/Style/SpinningBarStyle.php index 3c40014..db92813 100644 --- a/src/Style/SpinningBarStyle.php +++ b/src/Style/SpinningBarStyle.php @@ -13,4 +13,9 @@ class SpinningBarStyle implements StyleInterface "|", ]; } + + public function getWidth(): int + { + return 1; + } } diff --git a/src/Style/StyleInterface.php b/src/Style/StyleInterface.php index 97c13b8..90ae423 100644 --- a/src/Style/StyleInterface.php +++ b/src/Style/StyleInterface.php @@ -4,5 +4,13 @@ namespace NoccyLabs\Spinner\Style; interface StyleInterface { + /** + * Returns an array of frames used to render the spinner + */ public function getFrames(): array; + + /** + * Get the width of this spinner in characters + */ + public function getWidth(): int; }