From b61519f6fd547e3bbf5e329031930104bfbebad1 Mon Sep 17 00:00:00 2001 From: Stadly Date: Tue, 22 Jan 2019 12:26:38 +0100 Subject: [PATCH] Constant map in leet decoder --- src/WordFormatter/LeetDecoder.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/WordFormatter/LeetDecoder.php b/src/WordFormatter/LeetDecoder.php index 86df120..36aeb6c 100644 --- a/src/WordFormatter/LeetDecoder.php +++ b/src/WordFormatter/LeetDecoder.php @@ -8,10 +8,7 @@ final class LeetDecoder extends ChainableFormatter { - /** - * @var array - */ - private $encodeMap = [ + private const ENCODE_MAP = [ 'A' => ['4', '@', '∂'], 'B' => ['8', 'ß'], 'C' => ['(', '¢', '<', '[', '©'], @@ -42,7 +39,7 @@ final class LeetDecoder extends ChainableFormatter public function __construct() { - foreach ($this->encodeMap as $char => $encodedChars) { + foreach (self::ENCODE_MAP as $char => $encodedChars) { foreach ($encodedChars as $encodedChar) { $this->decodeMap[$encodedChar][] = $char; }