Created
December 8, 2025 14:22
-
-
Save mcsee/48219e56cf4a778e2ef635f9920ae954 to your computer and use it in GitHub Desktop.
This gist belongs to Clean Code Cookbook http://cleancodecookbook.com By Maximiliano Contieri http://maximilianocontieri.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| final class McpMessageParser { | |
| private $raw; | |
| public function parse() { | |
| return $this->stripStrangeCharacters($this->raw); | |
| } | |
| // This is the private method me need to test | |
| // For several different scenarios | |
| // Simplified here | |
| private function stripStrangeCharacters($input) { | |
| return preg_replace('/[^a-zA-Z0-9_:-]/', '', $input); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment