Get a thorough code review with refactored output, security checks, and best practices.
Review and refactor this [Language] code for quality, performance, and maintainability: ```[language] [Paste your code here] ``` Analyze for: 1. Code smells (long methods, duplications, magic numbers) 2. SOLID principles violations 3. Security vulnerabilities 4. Performance bottlenecks 5. Error handling gaps 6. Missing input validation 7. Documentation gaps 8. Test coverage opportunities 9. Naming conventions 10. Design pattern opportunities Provide: - Line-by-line issues with severity (critical/major/minor) - Refactored version with comments explaining changes - Unit test suggestions - Performance benchmarks (before/after) - Best practice alternatives