Andrew Fletcher published: 3 August 2022 1 minute read
Explain public, private, protected functions and variables inside a class in PHP.
I'll define a variable as a property
public | method or property this is the default and can be accessed anywhere |
protected | method or property that can be accessed by the class that declared it or that inherits the class |
private | method or property that can only be accessed by the class that declared it |
Related articles
Andrew Fletcher
•
09 Apr 2024
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException
Adding a new service to a custom module and the following error greeted me:The website encountered an unexpected error. Try again later.
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "summaries.reference_node". in...
Andrew Fletcher
•
05 Apr 2024
Drupal 9 to 10 upgrade an example of the actual steps taken
Continuing on from the Drupal 9 to Drupal 10 upgrade outline written earlier... Upgrading Drupal 9 to Drupal 10. However, the point of difference is this article works through the actual action steps of the upgrade.Planning and testing is critical for the Drupal to version 10 process to...
Andrew Fletcher
•
03 Apr 2024
How to log mail sent from the site for debugging when the body of the message is encrypted
To view the email before it's sent from Drupal, especially when using Drupal 10 and dealing with encrypted emails or a specific module like Mailhandler, you can take a few steps to intercept or debug the email before it's actually dispatched. The process involves either configuring your...