Let's consider I have a class named Logger in a separate file class-logger.php. This class allows me to easily log system messages of my Wordpress Plugin, whether into WP's debug.log or into my plugin's log file. Which is the best way of using this class across all classes which implement plugin's logic? Should I inject it as a dependency into __construct? Or I should implement the core class as a singleton and get all my common dependencies from it?
Aucun commentaire:
Enregistrer un commentaire