diff options
author | Alexander NeonXP Kiryukhin <frei@neonxp.info> | 2016-05-27 16:34:16 +0300 |
---|---|---|
committer | Alexander NeonXP Kiryukhin <frei@neonxp.info> | 2016-05-27 16:34:16 +0300 |
commit | 155b3006cd163dd852869dbbb2b4b71ddb3ab3b6 (patch) | |
tree | 92a55a8dcdac5d25ae80a038a3b29e1c0b89f529 | |
parent | 78ca15a1f84afe3969811180fe6ce643a2352a23 (diff) |
Added DB search 5
-rw-r--r-- | src/NeonXP/BotScript.php | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/src/NeonXP/BotScript.php b/src/NeonXP/BotScript.php index 55e16a6..6fb9c9f 100644 --- a/src/NeonXP/BotScript.php +++ b/src/NeonXP/BotScript.php @@ -48,73 +48,73 @@ class BotScript $getDb = function (Message $message, Telegram $telegram) { $text = trim(substr($message->getText(), 1)); $db = [ - '1' => ['А', 'А', 'A', 'Z', '000001', '. -'], - '2' => ['Б', 'Б', 'B', 'Y', '000010', '- . . .'], - '3' => ['В', 'В', 'C', 'X', '000011', '. - -'], - '4' => ['Г', 'Г', 'D', 'W', '000100', '- - .'], - '5' => ['Д', 'Д', 'E', 'V', '000101', '- . .'], - '6' => ['Е', 'Е', 'F', 'U', '000110', '.'], - '7' => ['Ё', 'Ж', 'G', 'T', '000111', '.'], - '8' => ['Ж', 'З', 'H', 'S', '001000', '. . . -'], - '9' => ['З', 'И', 'I', 'R', '001001', '- - . .'], - '10' => ['И', 'Й', 'J', 'Q', '001010', '. .'], - '11' => ['Й', 'К', 'K', 'P', '001011', '. - - -'], - '12' => ['К', 'Л', 'L', 'O', '001100', '- . -'], - '13' => ['Л', 'М', 'M', 'N', '001101', '. - . .'], - '14' => ['М', 'Н', 'N', 'M', '001110', '- -'], - '15' => ['Н', 'О', 'O', 'L', '001111', '- .'], - '16' => ['О', 'П', 'P', 'K', '010000', '- - -'], - '17' => ['П', 'Р', 'Q', 'J', '010001', '. - - .'], - '18' => ['Р', 'С', 'R', 'I', '010010', '. - .'], - '19' => ['С', 'Т', 'S', 'H', '010011', '. . .'], - '20' => ['Т', 'У', 'T', 'G', '010100', '-'], - '21' => ['У', 'Ф', 'U', 'F', '010101', '. . -'], - '22' => ['Ф', 'Х', 'V', 'E', '010110', '. . - .'], - '23' => ['Х', 'Ц', 'W', 'D', '010111', '. . . .'], - '24' => ['Ц', 'Ч', 'X', 'C', '011000', '- . - .'], - '25' => ['Ч', 'Ш', 'Y', 'B', '011001', '- - - .'], - '26' => ['Ш', 'Щ', 'Z', 'A', '011010', '- - - -'], - '27' => ['Щ', 'Ъ', ' ', ' ', '011011', '- - . -'], - '28' => ['Ъ', 'Ы', ' ', ' ', '011100', '- - . - -'], - '29' => ['Ы', 'Ь', ' ', ' ', '011101', '- . - -'], - '30' => ['Ь', 'Э', ' ', ' ', '011110 ', '- . . -'], - '31' => ['Э', 'Ю', ' ', ' ', '011111 ', '. . - . .'], - '32' => ['Ю', 'Я', ' ', ' ', '100000', '. . - -'], + '1' => ['А', 'Я', 'A', 'Z', '000001', '. -'], + '2' => ['Б', 'Ю', 'B', 'Y', '000010', '- . . .'], + '3' => ['В', 'Э', 'C', 'X', '000011', '. - -'], + '4' => ['Г', 'Ь', 'D', 'W', '000100', '- - .'], + '5' => ['Д', 'Ы', 'E', 'V', '000101', '- . .'], + '6' => ['Е', 'Ъ', 'F', 'U', '000110', '.'], + '7' => ['Ё', 'Щ', 'G', 'T', '000111', '.'], + '8' => ['Ж', 'Ш', 'H', 'S', '001000', '. . . -'], + '9' => ['З', 'Ч', 'I', 'R', '001001', '- - . .'], + '10' => ['И', 'Ц', 'J', 'Q', '001010', '. .'], + '11' => ['Й', 'Х', 'K', 'P', '001011', '. - - -'], + '12' => ['К', 'Ф', 'L', 'O', '001100', '- . -'], + '13' => ['Л', 'У', 'M', 'N', '001101', '. - . .'], + '14' => ['М', 'Т', 'N', 'M', '001110', '- -'], + '15' => ['Н', 'С', 'O', 'L', '001111', '- .'], + '16' => ['О', 'Р', 'P', 'K', '010000', '- - -'], + '17' => ['П', 'П', 'Q', 'J', '010001', '. - - .'], + '18' => ['Р', 'О', 'R', 'I', '010010', '. - .'], + '19' => ['С', 'Н', 'S', 'H', '010011', '. . .'], + '20' => ['Т', 'М', 'T', 'G', '010100', '-'], + '21' => ['У', 'Л', 'U', 'F', '010101', '. . -'], + '22' => ['Ф', 'К', 'V', 'E', '010110', '. . - .'], + '23' => ['Х', 'Й', 'W', 'D', '010111', '. . . .'], + '24' => ['Ц', 'И', 'X', 'C', '011000', '- . - .'], + '25' => ['Ч', 'З', 'Y', 'B', '011001', '- - - .'], + '26' => ['Ш', 'Ж', 'Z', 'A', '011010', '- - - -'], + '27' => ['Щ', 'Ё', ' ', ' ', '011011', '- - . -'], + '28' => ['Ъ', 'Е', ' ', ' ', '011100', '- - . - -'], + '29' => ['Ы', 'Д', ' ', ' ', '011101', '- . - -'], + '30' => ['Ь', 'Г', ' ', ' ', '011110 ', '- . . -'], + '31' => ['Э', 'В', ' ', ' ', '011111 ', '. . - . .'], + '32' => ['Ю', 'Б', ' ', ' ', '100000', '. . - -'], '33' => ['Я', 'А', ' ', ' ', '100001', '. - . -'], ]; $result = 'Непонятно :('; - $header = ' № | А | Я | A | Z | Двоичн | Морзе'; + $header = ' № | А | Я | A | Z | Двоичн | Морзе ' . PHP_EOL . '____________________________________'; if ($text == '$') { $result = ''; foreach ($db as $key => $value) { if ($key < 10) { - $result .= "0$key | $value[0] | $value[1] | $value[2] | $value[3] | $value[4] | $value[5]" . PHP_EOL; + $result .= "0$key | $value[0] | $value[1] | $value[2] | $value[3] | $value[4] | $value[5]" . PHP_EOL; } else { - $result .= "$key | $value[0] | $value[1] | $value[2] | $value[3] | $value[4] | $value[5]" . PHP_EOL; + $result .= "$key | $value[0] | $value[1] | $value[2] | $value[3] | $value[4] | $value[5]" . PHP_EOL; } } } elseif (is_numeric($text) && (isset($db[$text]))) { $value = $db[$text]; if ($text < 10) { - $result = "0$text | $value[0] | $value[1] | $value[2] | $value[3] | $value[4] | $value[5]" . PHP_EOL; + $result = "0$text | $value[0] | $value[1] | $value[2] | $value[3] | $value[4] | $value[5]" . PHP_EOL; } else { - $result = "$text | $value[0] | $value[1] | $value[2] | $value[3] | $value[4] | $value[5]" . PHP_EOL; + $result = "$text | $value[0] | $value[1] | $value[2] | $value[3] | $value[4] | $value[5]" . PHP_EOL; } } else { foreach ($db as $key => $value) { if (mb_strtolower($value[0], 'utf8') == mb_strtolower($text)) { if ($key < 10) { - $result = "0$key | $value[0] | $value[1] | $value[2] | $value[3] | $value[4] | $value[5]" . PHP_EOL; + $result = "0$key | $value[0] | $value[1] | $value[2] | $value[3] | $value[4] | $value[5]" . PHP_EOL; } else { - $result = "$key | $value[0] | $value[1] | $value[2] | $value[3] | $value[4] | $value[5]" . PHP_EOL; + $result = "$key | $value[0] | $value[1] | $value[2] | $value[3] | $value[4] | $value[5]" . PHP_EOL; } } if (strtolower($value[4]) == strtolower($text)) { if ($key < 10) { - $result = "0$key | $value[0] | $value[1] | $value[2] | $value[3] | $value[4] | $value[5]" . PHP_EOL; + $result = "0$key | $value[0] | $value[1] | $value[2] | $value[3] | $value[4] | $value[5]" . PHP_EOL; } else { - $result = "$key | $value[0] | $value[1] | $value[2] | $value[3] | $value[4] | $value[5]" . PHP_EOL; + $result = "$key | $value[0] | $value[1] | $value[2] | $value[3] | $value[4] | $value[5]" . PHP_EOL; } } } |