Using PHP ReflectionClass(); to Avoid Code Duplication | PHP CMS Part 3

Опубликовано: 07 Октябрь 2024
на канале: Unconventional Coding
236
5

Before I move on to create the WYSIWYG editor for my custom PHP Content Management System, I need to do some refactoring. In today's video I remove some code duplication from my project with the help of the ReflectionClass of PHP. I've never used this class before (and it might not be intended for this purpose) but I had fun doing it anyway!

GitHub: https://github.com/unconv/custom-cms
Support: https://buymeacoffee.com/unconv

Part 1:    • Building a PHP Content Management Sys...  
Part 2:    • Storing PHP objects in Database as JS...  

00:00 Intro
01:20 Refactoring get_db()
03:51 Refactoring get_json()
04:09 Refactoring render()
12:30 Debugging
20:31 Refactoring get_array()
23:13 Refactoring from_json()
30:01 Conclusion